🥦 WIC Recipe Parser
The Inspiration
Every week, 4.7 million families walk into grocery stores with WIC benefits and walk out confused. WIC (Women, Infants, and Children) provides crucial nutrition assistance, but here's the gap no one talks about: WIC helps you shop, not cook.
Existing tools like WICShopper tell you what's eligible at checkout. But what happens when a mom finds a pancake recipe online that calls for butter, all-purpose flour, and whole milk? She has no easy way to know which ingredients are covered, what to swap, or how to rewrite the entire recipe. That friction means wasted benefits, missed meals, and stress.
I built WIC Recipe Parser to close the gap between the grocery store and the kitchen table.
What It Does
WIC Recipe Parser is an AI-powered tool that transforms any recipe into a WIC-friendly version in seconds:
- Paste any recipe (or load one of our 4 family favorites)
- AI parses ingredients using structured NLP extraction
- Instant eligibility check against a hardcoded WIC food ontology
- Smart substitutions suggest WIC-approved alternatives with explanations
- Full recipe rewrite generates step-by-step cooking instructions
- Auto-generated shopping list grouped by category (Produce, Dairy, Grains, Proteins, Other)
- Servings scaler adjusts quantities for any family size
- Spanish toggle translates the entire output for accessibility
- Export downloads a clean recipe card
How I Built It
Architecture
Our system uses a hybrid local + cloud AI architecture:
$$ \text{Recipe Input} \xrightarrow{\text{Featherless Qwen2.5-14B}} \text{Structured JSON} \xrightarrow{\text{Local Fuzzy Match}} \text{WIC Check} \xrightarrow{\text{Featherless AI}} \text{Substitutions + Rewrite} $$
- Local layer: Python fuzzy-matching against a hardcoded WIC food database (150+ items) for speed and zero API cost on eligibility checks
- AI layer: Featherless.ai's OpenAI-compatible API with
Qwen/Qwen2.5-14B-Instructhandles parsing, substitution reasoning, and recipe rewriting via constrained JSON generation
The Code
I wrote the entire app in under 18 hours using Cursor's and Codex AI-assisted editor. The core logic lives in three files:
app.py— Streamlit UI, API orchestration, and session state cachingwic_database.py— WIC food ontology + 50+ fallback substitutions for offline resiliencerequirements.txt— Minimal dependencies (streamlit,openai)
Challenges I Faced
1. The "Original Ingredient" JSON Bug
Our first API prompt asked the model to return substitutions as JSON. The model kept returning literal keys like "original_ingredient" instead of the actual food name (e.g., "butter"). This broke the parser entirely.
Fix: I rewrote the prompt to explicitly say "The KEYS must be the exact original ingredient names" and added a clean_json() helper to strip markdown code blocks from LLM output.
2. Duplicate Streamlit Keys
When displaying the shopping list, repeated items across categories caused StreamlitDuplicateElementKey crashes.
Fix: I switched from using item names as keys to using enumerated indices:
for idx, item in enumerate(items):
st.checkbox(item, key=f"shop_{category}_{idx}")
3. API Latency During Demo
The 14B model occasionally took 15+ seconds per call, which would kill a live demo.
Fix: I implemented st.session_state caching so that parsed ingredients and substitutions are stored in memory. If a user only changes the servings slider, the app rescales locally without re-calling the API.
4. No Central WIC API
There is no public federal API for real-time WIC eligibility by state.
Fix: I hardcoded a comprehensive list based on USDA federal guidelines and added a clear disclaimer that state rules may vary.
What I Learned
Constrained generation is harder than chat. Asking an LLM to return valid JSON with specific keys is a different skill than casual prompting. Temperature tuning (0.1 for parsing, 0.3 for substitutions, 0.4 for rewriting) made a huge difference in reliability.
Hybrid architectures win hackathons. Keeping eligibility checks local saved API costs and latency, while reserving the LLM for creative tasks (substitutions, rewrites) where it shines.
Session state is essential. Streamlit reruns the entire script on every interaction. Without
st.session_state, we would have burned through API credits and made users wait 20 seconds per click.Accessibility matters. Adding a Spanish toggle took 10 minutes of prompt engineering but dramatically expanded the tool's impact for WIC families.
What's Next
- State-specific databases: Expand beyond federal guidelines to California, Texas, New York, Florida, and Illinois WIC lists
- Image/PDF OCR: Let users snap a cookbook page and auto-extract ingredients
- Nutrition API integration: Show side-by-side nutrition facts (original vs. adapted)
- Voice input: For families with low literacy or visual impairments
- WIC allotment tracker: Input monthly benefits and flag if the shopping list exceeds budget
Impact
WIC Recipe Parser serves 4.7 million WIC families in the US. By turning any recipe into a benefits-friendly meal plan, I reduce food waste, stretch family budgets, and make healthy cooking accessible. This is computational linguistics for social good. Built with | Layer | Tool | | ---------- | ------------------------------------------- | | Frontend | Streamlit | | AI Models | Featherless.ai (Qwen2.5-14B-Instruct) | | NLP | Structured JSON extraction + entity linking | | Database | Hardcoded WIC ontology (federal guidelines) | | Editor | Cursor (AI-assisted coding) | | Deployment | Streamlit Community Cloud |
Built for LingHacks VII | June 2026
Log in or sign up for Devpost to join the conversation.