DEV Community

TechGirl007
TechGirl007

Posted on

Fridge2Fork ~ Before it Goes in the Bin

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission 💸

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle

What I Built

You open the fridge. Three eggs, half a bag of spinach that's starting to wilt, some feta, a heel of stale bread. You stand there with the door open, have no idea what to make, and order takeaway. The spinach goes in the bin on Thursday.

Why it matters

Every day, the world throws away more than a billion meals, while 783 million people go hungry. Most of that waste does not happen in farms or supermarkets, but at home.

That small amount in the fridge adds up. According to the UN Environment Programme's Food Waste Index Report 2024:

  • 1.05 billion tonnes of food were wasted in 2022, about one fifth of all food available to consumers, on top of the 13% lost between harvest and the shops.
  • Households wasted 631 million tonnes, about 60% of it. That's 79 kg per person per year, more than restaurants (28%) and shops (12%) put together.
  • Food that's grown but never eaten is linked to 8–10% of global greenhouse gas emissions, about five times the emissions of the aviation sector. Food rotting in landfill releases methane, which traps far more heat than CO₂ in the short term.
  • It costs the world economy an estimated US$1 trillion a year.

It costs families too: around AU$2,500 a year for an Australian household (about $48 a week) and roughly £780 a year for a UK family (WRAP). With food prices and interest rates rising, $48 can make a big difference.

The UN's Sustainable Development Goal 12.3 aims to halve per-person food waste in shops and homes by 2030. Governments and supermarkets can't do that on their own. It comes down to millions of small decisions in millions of kitchens. Fridge2Fork helps with that decision: what to cook with what you already have.

Fridge2Fork fixes that moment. You type in what's in the fridge, tick what's in your spice rack and cupboard, and a local AI suggests a recipe that uses up as much of it as possible (tap 🔄 for another). Each one shows how long it takes, which of your ingredients it uses up, anything else you'd need to buy, and step-by-step instructions.

You can steer it:

Option Choices
🧂 Spices 18 common spices (salt, cumin, curry powder, Italian herbs…) plus add your own. Recipes only use what's ticked.
🥫 Cupboard stock cubes, tinned tomatoes, pasta, rice, coconut milk, soy sauce… plus add your own
Meal breakfast, lunch, dinner or snack (it guesses from the time of day)
Kind of dish 🎲 Surprise me, or ask for a soup, curry, stir-fry, salad, fritters, pie…
Cuisine Mexican, Japanese, Spanish, Dutch, Italian, Indian, Thai, Korean and more
Diet / time / servings vegetarian, vegan, gluten-free, dairy-free · 15 to 90 minutes · 1 to 50 people
Who's cooking 🏠 Home cook, ☕ Cafe special, or 🛒 On a budget (reduced specials, with prices and a budget)
❄️ Extra to freeze cook 2, 4 or 6 extra portions for lunches or another dinner; every recipe says whether it freezes and how
📖 My recipes save the ones you love, or add family favourites, and it adapts them to what you have
🥗 Side dish Auto: when your own recipe leaves food over, it becomes a side (soup and roasted veg chips)
🔄 Another idea one more dish, added under the others, never repeating one you've seen

Your spice rack and cupboard are remembered, so you only set them up once.

Your favourites, minus what's missing. Save a recipe you love (or type in your mum's lasagne), and Fridge2Fork will adapt it to what's actually in the fridge. As you type your ingredients, it shows which saved recipes fit ("Easy roast potatoes · you have 4 of 7"), so you can pick one yourself. Each card then says "♥ Based on your Spaghetti Carbonara" and lists what changed, e.g. "pancetta and parmesan swapped for bacon and cheddar". And every recipe has a 📄 Save as PDF button, so you can send it to whoever's cooking tonight.

Stretch tonight into tomorrow. Every recipe now says ❄️ "Freezes well: cool, portion into tubs, up to 3 months" or 🍽️ "Best eaten fresh". Choose ❄️ Extra to freeze and it cooks extra portions, picking only dishes that freeze (the app checks, and asks again if not). Tell it what a meal usually costs you, and it shows what that's worth: "That's 2 meals you won't have to buy, about $16." One fridge-clear-out becomes tonight's dinner and Wednesday's lunch.

Who would pay for it?

Food is wasted in three places, and Fridge2Fork has a mode for each:

Where food is wasted (UNEP 2024) Fridge2Fork mode Who it helps
Households, ~60% 🏠 Home cook + ❄️ freezer portions families, students, anyone on a tight budget
Food service, ~28% ☕ Cafe special small cafés and restaurants
Retail, ~12% 🛒 On a budget shoppers buying reduced "eat today" specials, and the shops trying to sell them
Before the shops (13% lost after harvest) 🛒 + a printed recipe card market sellers with produce that's too "ugly" to sell at full price

🛒 On a budget came from my first users (more below). Supermarkets mark food down when it must be eaten today. Type in the specials with their prices, set a budget, and each recipe shows what to buy and what it costs: "🛒 Buy: chicken thighs $3.50, spinach $1.20 · ≈ $4.70 ($1.18 a portion) · fits your $8 budget." The code does the adding up, not the model.

A greengrocer's "rescue box". At my local market, a fresh produce seller told me how much of his stock gets thrown away because it doesn't meet "quality" standards: a bent carrot, a marked zucchini, nothing wrong with it to eat. He said an app like this would be great to see. That's a business: a box of imperfect veg at a discount, sold with a Fridge2Fork recipe card printed for exactly what's in it. The seller gets money for stock he'd otherwise bin, and the shopper gets dinner sorted.

The Cafe special switch is the clearest side hustle. Small cafés and restaurants throw away a lot of food, and that waste is money. A café owner can type in "2 kg spinach, half a wheel of feta, yesterday's sourdough" in the morning and get a sellable today's special that turns stock that's about to go off into revenue.

Because the model runs on the café's own computer, there's no monthly API bill and no per-request cost, so it's cheap enough to offer as a one-off purchase or a small subscription. And for home cooks, it just answers the question I ask myself every single evening.

What if a million people used it?

Here's the maths, with cautious numbers so you can check it. Say one use rescues the food for one meal: about $10 and half a kilo that would otherwise be thrown out. (The average person wastes 79 kg of food a year at home, about 1.5 kg a week, so half a kilo is modest.)

If 1 million people… Money saved Food kept out of the bin
use it once ~$10 million ~500 tonnes
use it once a week for a year ~$520 million ~26,000 tonnes

And with ❄️ freezer portions, one cook also covers two more meals you don't have to buy, so a single use can be worth closer to $25–30 for a family.

Demo

Fridge2Fork runs entirely on my own laptop, so there's no hosted link to click. Instead, here's the app, and the dinner it planned:

Fridge2Fork: tick your spices, and get a recipe that uses up your fridge

Getting it running yourself takes about two minutes (see Code below).

Code

GitHub logo TechGirl007 / fridge2fork

Turn what's left in your fridge into family meals before it goes in the bin. A local open-source AI (Gemma via Ollama) suggests creative recipes from your fridge, cupboard and saved favourites: soup and leftover chips, veggie cottage pie and more. Free, private and offline. Supporting UN SDG 12.3: halve food waste by 2030.

Fridge2Fork: from fridge to fork, before it goes in the bin

🥕 Fridge2Fork

From fridge to fork, before it goes in the bin.

Type in what's in your fridge, tick what's in your spice rack and cupboard, and a local open-weight AI suggests recipes that use it up. Nothing leaves your computer.

Built for the DEV Hacktoberfest 2026 Open-Source AI Challenge, Week 2: "Side Hustle".

Features

  • Fridge → recipes: one idea at a time (🔄 for another), each with time, ingredients it uses up, anything extra you'd need, and steps
  • Your own recipes first: if you can nearly make a saved recipe ("you have 6 of 7"), that's the first idea, adapted to what's missing. It knows a shallot will do for an onion.
  • 🥗 A side from the leftovers: whatever your main doesn't use becomes a side, like soup and roasted veg chips
  • Rescue dishes for soft or ageing veg: cottage pie with a mash topping from almost any…

ollama pull gemma3
python3 app.py
# open http://localhost:8000
Enter fullscreen mode Exit fullscreen mode

No pip install, no API keys, no accounts. Just Python's standard library and Ollama.

How I Built It

My process: from a text box to a meal planner

The idea came from my own fridge. My goal for this week was simply to learn and to submit, so I picked something small that I'd actually use. I built it with Claude as a coding partner, and the journey went like this.

1. Start simple. Version 1 was a text box and a button: ingredients in, recipes out. It worked, and it was boring.

2. Add layers, one real annoyance at a time. Every layer came from using it myself:

  • 🧂 Spices, because the model cheerfully called for saffron I don't own
  • 🥫 Cupboard, so it knows I have stock cubes and rice without asking
  • Meal, cuisine and kind of dish, so I can ask for a Mexican breakfast or a soup tonight
  • 📖 My recipes: save favourites, or import from the web (it reads the recipe card hidden in most recipe sites, and gemma3 cleans up pasted pages, skipping the life story and the adverts)
  • ❄️ Freezer portions: tonight's dinner becomes Wednesday's lunch
  • 🛒 On a budget, the idea from my first users: reduced "eat today" specials, with prices, within a budget

3. Make it think like a cook. The model would never say "you can nearly make your own asparagus soup". So the code matches the fridge against my saved recipes, and knows that a shallot will do for an onion and that stock in the cupboard counts. When I have 6 of 7 ingredients, my own recipe comes first. Then it looks at what the soup doesn't use (carrots, celery, half a lemon) and turns that into a side: soup and roasted veg chips, a winner for families, and more of the fridge used up.

4. Hit the wall: my laptop. Every layer made the prompt longer and the answer longer. I'm running a 4B model on a laptop with 7 GB of RAM and no GPU. I measured it: gemma3 reads about 25 tokens (word pieces) a second here, and writes about 10. By the time it was writing two recipes, each with a side, one answer took three minutes, longer when it had to ask again.

5. Design around the device. Instead of giving up features, I cut what each answer costs: a shorter prompt (the model only needs a saved recipe's ingredients, not its whole method), shorter steps, fewer retries, and one idea at a time with a 🔄 Another idea button. The first idea, my own soup with chips on the side, now arrives in about a minute.

6. Where it's going. I picture Fridge2Fork as a phone app you use in the supermarket aisle: you see the reduced specials, add them, see what you can make, and cook it at home that night. Small Gemma models already run on phones, so it could stay offline, private and free.

The closed tool helped me build it, and the open model is it.

How it works

browser form ─► app.py ─► gemma3 (4B) via Ollama ─► JSON ─► recipe cards
 fridge, spices,  builds the   runs on my laptop's CPU    validated,
 cupboard, meal,  prompt                                  cleaned up
 cuisine, diet
Enter fullscreen mode Exit fullscreen mode
  • app.py is a small Python server using only the standard library. It serves the page and has one endpoint, /api/recipes.
  • It builds a prompt from everything you chose and sends it to gemma3 (4B) running locally in Ollama, with format: "json" so the reply comes back as structured data: name, pitch, minutes, uses, also_need, steps.
  • It validates the reply and retries if the model returns broken or incomplete JSON.
  • index.html is a single page with no frameworks and no build step. It renders the recipe cards and remembers your cupboard in the browser.

On my laptop (7 GB of RAM, no GPU), the first idea takes about a minute (40 seconds without a side). The page shows a little bobbing 🍲 and a timer so you know it's working.

Things that went wrong (and what I learned)

"NetworkError when attempting to fetch resource." The first time I tried it, I double-clicked index.html instead of going to localhost:8000. A page opened from a file has no server behind it, so the request went nowhere. Now the page detects that and talks to the local server directly, and if the server isn't running, it tells you so in plain English.

The model listed things I already had. Early on, "You'd also need" kept saying olive oil and butter. Telling it plainly that oil, butter, flour, sugar and water are always available fixed most of that. But even with the cupboard list, it once told me I'd need rice when rice was ticked. Rather than keep arguing with the prompt, I filter those out in code. Lesson: a small model follows instructions mostly, so check the important rules in code.

I almost had the model ask questions. I wanted it to ask "do you have stock cubes?" before suggesting recipes. But on a CPU, every round trip costs about 40 seconds, so a back-and-forth would have been painful. A cupboard checklist gives the model the same information instantly. Lesson: with a local model, design around latency.

Restricting spices made the recipes better. Once the model could only use the spices I'd ticked, the recipes went from "nice idea, but I don't have saffron" to things I could actually cook tonight.

Every recipe was a hash, a stew, a bake or a scramble. Give a small model four vegetables and it plays it safe, every time. People would get bored by day three. So now the code picks the style, not the model: each request draws two different styles (stir-fry, curry, fritters, dumplings…) and gemma fills them in. If you ask for a soup, the app checks that both answers really are soups, and asks again if not. Lesson: a small model is a good writer but a poor decider, so make the decisions in code.

A risotto with no rice. The random styles once gave me a "cauliflower risotto" when I had no rice. A risotto without rice isn't a risotto. Now a style that's built on a base (rice, pasta, tortillas, bread, pastry, eggs) is only picked when that base is in your fridge or cupboard.

"Taco spice" meant tacos. I had taco spice ticked, and gemma kept slipping tortillas into everything, even a soup. Telling it "a spice is only seasoning" helped, but the real fix was code again: if a recipe leans on a base you don't have, the app asks once more.

Old recipes sneaking in. With just three ingredients, I'd get dishes using things I'd never typed. The app wasn't remembering past requests: my saved recipes were. Any saved recipe sharing a single word with my fridge ("chicken") went into the prompt with its whole ingredient list, and gemma used the lot. Now a saved recipe is only used automatically when you have at least 40% of it, and the others are shown as buttons so you choose.

Every feature made it slower. This was the biggest obstacle of the week. Each layer added words to the prompt and to the answer, and on a CPU every word costs time: from about 40 seconds to three minutes. Measuring it (about 25 tokens a second in, 10 out) showed exactly where the time went, and asking for one idea at a time got the first answer back to about a minute. Lesson: on a small device, the length of every prompt and reply is part of the design.

A shallot isn't an onion (to a computer). The app said I had only 1 of the 9 ingredients for my own asparagus soup. It didn't know shallots and onions are interchangeable, it counted butter and oil as missing, it ignored the stock in my cupboard, and it counted "bread to serve (optional)" against me. With simple swap rules, it now says 6 of 7.

What I'd add next

Fridge2Fork is a proof of concept: it shows that a 4B model on a 7 GB laptop can already plan dinner. From here, it can grow in two directions without giving up being open.

Version 1.5

  • 🍳 My kitchen: tick what you own (soup maker, blender, Thermomix, air fryer, slow cooker) and recipes are written for it: "add everything to the soup maker, smooth setting". And nobody gets told to blend who doesn't own a blender.
  • ⚖️ Quantities: amounts for each ingredient, scaled to servings and freezer portions in code, because scaling is maths, and maths is what small models get wrong.

Beyond that

  • Bigger open models. A 4B model has a small imagination. With leftover veg and a cauliflower, it never suggested the obvious veggie cottage pie (sauté the veg, mash the cauliflower for the topping), a dish I'd happily cook. I've since taught the code to pick "rescue" dishes like cottage pie (almost any root veg or cauliflower makes the topping), but a bigger model would know far more dishes like it on its own. The model is one setting, so the same app can run larger open-weight models such as gpt-oss-20b (OpenAI's open-weight model), Gemma 3 27B or Qwen 3. They write better recipes and follow the rules more reliably, and need less checking in code. On a machine with 16 GB+ of RAM that's just MODEL=gpt-oss:20b python3 app.py. For a paid version, the same open models could run on a hosted server, while keeping the free, private local mode as the default.
  • A phone app. Shoppers need it in the shop, not at their laptop. Small Gemma models already run on phones, so an on-device version would work offline in the supermarket aisle, with nobody's shopping data leaving the phone.
  • Snap the fridge. gemma3 can read images, so the next step is uploading a photo of the fridge and letting it list the ingredients for you.
  • A shopping list built from "You'd also need" across the week.
  • Café mode extras: pricing suggestions, allergen labels, and a printable specials board.
  • Fine-tuning on a café's own menu, so the specials match its style.

Why Does Open Innovation Matter?

For this project, open made it practical:

  • It costs nothing to run. Every request runs on my laptop. A café could generate specials all day and never see a bill. With a paid API, cost per request would decide whether this works as a business at all.
  • The savings stay with the people who need them. An app that helps a tight budget shouldn't come with a subscription. Running an open model locally means every dollar saved on food stays saved.
  • It's private. What's in your fridge, what you eat and your diet never leave your computer. For a café, its stock levels and supplier details stay in-house.
  • It works offline. No internet, no problem. It also keeps working if a provider changes its prices or shuts down a model.
  • It's swappable. One environment variable (MODEL=llama3.2 python3 app.py) switches to a different open model. Nobody can lock me in.

My First User

My sister and a friend. My sister sent me what was in her fridge, and a friend sent me a photo of hers. I typed both into Fridge2Fork and sent back the recipes. Their suggestion back was the best feedback I got all week: "Wouldn't this be great at the grocery store?" Supermarkets mark food down when it has to be eaten that day. Someone on a tight budget could type in the specials, see what they could make, and decide what to buy. That became 🛒 On a budget mode.

And honestly, me. This answered my own "what should we have for dinner?" problem, which is exactly why I built it. It suggested an asparagus and sweet potato soup. I cooked it in my soup maker, turned the leftover carrots and half a sweet potato into roasted veg chips, and toasted two slices of bread from the freezer for dipping. Nothing in that dinner was bought for it.

A market seller. I told a fresh produce seller at my local market about the app. He said it would be great to see, because so much of his produce doesn't meet "quality" standards and has to be thrown away. That's where the "rescue box + recipe card" idea came from.

Did anyone pay? Not yet: it's a week old and runs on my laptop. But the market seller is the clearest lead. His imperfect produce is money he currently throws away, and a recipe card that helps it sell is something a small business could pay for.

Prize Categories

Best Use of Gemma. gemma3 (4B) is the whole engine of Fridge2Fork. It runs locally on a laptop CPU through Ollama (7 GB RAM, no GPU) and writes every recipe from what's actually in your fridge, spice rack and cupboard.

What I learned about using it well:

  • Strict JSON output (format: "json") with a fixed set of fields lets recipes drop straight into the page, with validation and retries for the odd broken reply.
  • Tight constraints help a small model. "Season only with the spices listed" turned generic recipes into ones I could actually cook.
  • Check the important rules in code. The model mostly follows instructions, so a small server-side filter removes anything from "also need" that the user already has.
  • A small context (2,560 tokens) keeps it inside a 7 GB laptop's memory, and short prompts and replies keep it fast: one idea at a time, in about a minute.

It shows that a 4B open model on an ordinary laptop is good enough to plan dinner, for free.

Best Use of ElevenLabs. I used ElevenLabs to generate the narration for my demo. Fridge2Fork runs on a laptop with 7 GB of RAM, and when I tried to record myself talking while gemma3 was running, the laptop ran out of memory and crashed. So I recorded the app silently, wrote a script, and had an ElevenLabs voice read it over the top. The opening image of the fridge was made with ElevenLabs Image too.

That fits the app's idea. The heavy work runs locally, and the voice is added afterwards, so nothing about your fridge leaves the laptop. Next, I'd like Fridge2Fork to read the steps out loud while you cook, so you don't have to touch the screen with floury hands.

Top comments (0)