There are setups that help with these problems. I made a post on weightgaming that compiles a few of the most useful setups. It includes a setup for getting an exact amount of ingredients into a crafter, and 2 setups for keeping ovens fueled. Here is a link: https://forum.weightgaming.com/t/gain-factory-weight-gain-factory-builder/34726/...
The idea is to use logic gates to detect when the structure outputs the items and only then input the correct amount of items, but the post I linked explains it better.
Edit: hellwraiz beat me to the punch on answering, their setup is good too!