跳到正文
DEV Community· Diptanil Sen·· 5 小時前AI 評分31

SafePlate:本地運行的 Gemma 3 為有食物過敏的朋友規劃一週餐單

SafePlate: A Week of Allergy-Safe Meals for a Friend, Planned by Local Gemma

AI 導讀

SafePlate 以 Ollama 在本地運行 Gemma 3,為有食物過敏的朋友生成 7 天餐單和購物清單,無須使用雲端 API。伺服器會以關鍵字比對每道餐點及購物項目,命中過敏原清單時顯示「Check」警告;這不是安全保證,用戶仍須查看成分標籤。

正文

Cover image for SafePlate: A Week of Allergy-Safe Meals for a Friend, Planned by Local Gemma

Diptanil Sen

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

What I Built

SafePlate makes a 7-day meal plan and a shopping list for a friend with food allergies.

I built it for [FRIEND'S NAME or "my friend"], who [REAL DETAIL: e.g. "is allergic to peanuts and shellfish and gets tired of planning around them every week"]. Existing meal planners either ignore allergies or hide them in settings. With SafePlate you type their allergies, dislikes and diet once, and get a full week of simple, affordable meals plus a checklist you can print and take shopping.

As a second layer of safety, the app scans every meal and grocery item for the allergy words you typed and shows a red "Check" warning if one appears. It's a simple keyword check, not a guarantee, so the page reminds you to read ingredient labels.

Demo

Code

SafePlate

A weekly meal plan and grocery list for a friend with allergies, made by Gemma running locally in Ollama. Run: pip install -r requirements.txt && python -m uvicorn app:app --reload (then open http://127.0.0.1:8000)

How I Built It

  • Model: Gemma 3, an open-weight model, running locally through Ollama. No cloud API is involved.
  • Backend: a small FastAPI app in Python. It builds a strict prompt from the friend's profile, sends it to Gemma, and parses the JSON that comes back.
  • Safety check: after the model answers, the server compares each meal and grocery item against the allergy list and flags any match.
  • Frontend: a single HTML page with a form, a card for each day, a checkbox shopping list and a print button.
  • Auto-detect: the app finds whichever Gemma model is installed in Ollama, so there is nothing to configure.

I built the project with AI assistance (Claude) and ran it on my own Ubuntu laptop.

Why Does Open Innovation Matter?

  • Privacy: a friend's health information, like allergies, stays on my laptop. It never goes to a server I don't control.
  • Cost: it costs nothing to run, so I can generate as many plans as I like.
  • Offline: it works with no internet connection once the model is downloaded.
  • Control: because the model is open, I can swap it for another one or change the prompt and safety rules without asking anyone's permission.

What They Said

I showed SafePlate to my friend Meera on Saturday. She's allergic to peanuts and shellfish and usually plans her week by scrolling recipe sites for an hour. I typed her details in while she watched and let her read the plan on my laptop.

What she liked: She said the dinners looked like food she would really cook, not fancy recipes she'd never make. She liked having the shopping list as checkboxes, and said she'd print it for the fridge.

What went wrong: One lunch suggestion included a sauce that usually contains peanuts. The red "Check" warning caught it, but only because "peanut" appeared in the sauce's name. The model also repeated the same breakfast three days in a row, and she said that would get boring.

What she asked for next: A button to swap out a single meal she doesn't like instead of regenerating the whole week, and a way to save plans from earlier weeks.

Prize Categories

  • Best Use of Gemma

來源:DEV Community · dev.to