Build for a Friend: a local-first meal planner on open-weight Gemma
说明与用途
一个完全在本地运行的膳食规划器,使用Gemma 3 1B模型通过Ollama生成七天的印度餐单,包含购物清单和预算检查,并通过确定性过敏警报机制确保食物安全,完全离线运行,无需云服务。
问题
Providing a high-protein vegetarian meal plan on a ₹2000/week budget while avoiding peanuts and lactose, without relying on cloud services or API keys.
结果
The app delivers a 7‑day meal plan within ~40s on CPU, keeps all health data local, works offline, and is free forever.
工作流
- 1. Install Ollama and pull gemma3:1b model
- 2. Run python3 app.py
- 3. Open http://localhost:8000 in browser
- 4. Enter friend’s profile (diet, allergies, dislikes, budget)
- 5. Receive streamed meal plan token by token
- 6. Review Allergy Check section for flagged dishes
- 7. Adjust plan if needed
证据
My roommate Nagaraj needed high-protein vegetarian food on a ₹2000/week budget — while strictly avoiding peanuts and lactose.
Friend Meal Planner — a web app (vanilla HTML/JS + a zero-dependency Python server, stdlib only) that generates a 7-day Indian meal plan with a grocery list and budget check.
run python3 app.py and open http://localhost:8000 (needs Ollama + gemma3:1b pulled; ~40s per plan on CPU)
Testing caught something important: the 1B model kept suggesting paneer and yogurt to my lactose-allergic friend, despite explicit instructions.
I added a deterministic allergy guardrail — every plan is scanned line-by-line against an allergen keyword map and an ⚠️ Allergy Check section is appended flagging risky dishes for review.
- 记录日期: 2026-10-05T04:55:55.280Z