DEV Community

Anish Agarwal
Anish Agarwal

Posted on AI-assisted

A dinner planner for my vegetarian friend that doesn't trust its own AI

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

My friend is vegetarian, so "what's for dinner?" always comes with a rule: no meat, no fish, and none of the hidden stuff either, like gelatin or Worcestershire sauce. I wanted a tool that looks at what is actually in their kitchen and suggests dinners that follow that rule every time.

Safe Plate is a single-page meal planner. You enter who it's for, what they avoid, what they don't like, and what's in the kitchen. A small language model running on my own laptop suggests dinners.

The part I care about is what happens next. A language model can slip a forbidden ingredient into a recipe while sounding completely sure of itself, so every suggestion goes through a second check written as plain code. Anything that matches the restriction list turns red and drops to the bottom of the page. Anything that doesn't gets a green "Passed the allergen check" label. The same tool works for allergies: type "peanut, dairy" instead of "vegetarian".

Demo

Watch the demo video

The video shows the form filled in for a vegetarian dinner and the results with their check labels. Everything runs locally, so there is no hosted link to click. The AI lives on my laptop.

Code

Safe Plate

A dinner planner for one specific person. A local open-weight model suggests meals; plain code then checks every ingredient against that person's allergy list and flags anything that matches.

Run it

  1. Install Ollama, then pull a model: ollama pull gemma3:4b
  2. In this folder, start a local server: python3 -m http.server 8000
  3. Open http://localhost:8000

Opening index.html straight from disk won't work, because Ollama blocks requests from file pages. If you prefer that, start Ollama with OLLAMA_ORIGINS="*" ollama serve.

To use a different model, change the name under "Model settings". Everything runs on your machine, and settings are stored only in your browser.

Limits

The allergen check is a word list, not a medical tool. It errs toward flagging, so "almond flour" will be flagged for wheat. Always read labels.




The README has the run instructions.

How I Built It

  • Model: Gemma 3 1B, an open-weight model from Google, running through Ollama on a low-spec Windows laptop. It's an 815 MB download. The model name is a text field in the app, so any Ollama model works.
  • App: One HTML file with no framework and no build step. It calls Ollama's local chat endpoint and asks for the meals as JSON, with a schema to enforce the shape. If Ollama rejects the schema, it retries in plain JSON mode.
  • The check: A word list that expands entries like "vegetarian", "dairy" or "nuts" into the ingredients they cover, then scans everything in a suggestion except the one-line blurb: title, ingredients and steps. It errs toward flagging, so "almond flour" trips a wheat restriction and "meatless" trips a meat one.
  • Privacy: Settings are saved in the browser, and the only network request the page makes goes to the Ollama server on my own machine.
  • Help: I wrote it with help from Claude, Anthropic's AI assistant, which also helped me debug it.

What Testing Showed

A 1B model on a weak laptop shows you exactly where the weak spots are.

It ignores formatting instructions. I asked for each step as a line of text. The model returned each step as a small object, and the page printed [object Object] four times. In one run it crammed every ingredient onto one line. In another the ingredients came back without amounts.

The bug that mattered was in my code, not the model. My first version only scanned the title and the ingredient list, and it read any value that wasn't plain text as the literal string "[object Object]". A banned ingredient hiding in the steps, or arriving in an unexpected shape, would have passed. I fixed that so the check flattens and scans the full text of every suggestion, whatever shape it takes. I also had the app ask Ollama to enforce a strict format, and made the page tolerant of messy output by splitting a block of steps into one per sentence and trimming stray commas.

The recipes themselves were plain but sensible. From a pantry of rice, lentils, spinach, tomatoes, potatoes, onions and garlic, it suggested a lentil rice and a potato and lentil curry, and both correctly passed the vegetarian check.

Why Does Open Innovation Matter?

Dietary restrictions and allergies are health information, and I didn't want my friend's sent to a server neither of us controls. Because the model runs locally, the tool works with no internet connection and no account, and costs nothing per request. The model doing the work is an 815 MB download that runs on a laptop with weak specs.

Open weights also make the model a swappable part. If a bigger model writes better recipes, I change one text field and nothing else moves. And because the safety check lives in my own code instead of a vendor's content filter, it behaves the same whichever model sits behind it, and it can't change under me when a hosted API updates.

The honest trade-off is quality. A large hosted model would write better recipes than a 1B model on my laptop. For this job I accepted rougher recipes in exchange for privacy, zero cost and control, and I let plain code, not the model, have the final say on safety.

Prize Categories

  • Best Use of Gemma: Safe Plate runs Gemma 3 1B locally through Ollama.

Top comments (0)