Skip to content

gunmentoy/munchr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Munchr

Your AI-powered cooking companion.

Munchr is a recipe search and AI substitution assistant built with Python and Streamlit. Browse a pre-seeded collection of ~2,000 recipes sourced from AllRecipes.com, view ingredients and step-by-step instructions, and ask Google Gemini AI for ingredient substitutions when you're missing something in your kitchen.

Built for BABI 4005 - BCIT Business & Data Analytics

Live Demo: munchr.streamlit.app


Screenshots

Search View Recipe Detail AI Assistant
Search View Recipe Detail AI Assistant

Features

Feature Description
Pre-Seeded Recipe Database Ships with ~2,000 recipes across 186 search categories - ready to browse out of the box
Keyword Search Search the local SQLite database by keyword; matches against titles, ingredients, and cuisines
"I'm Feeling Hungry" Click once and get a random recipe from the collection
AI Ingredient Substitutions Ask Munchr AI what to use when you're missing an ingredient - powered by Google Gemini
Multi-Ingredient Support Ask about multiple missing ingredients at once (e.g. "I don't have cream or parmesan")
Custom UI Roboto Mono font, crimson/gold/cream/charcoal colour palette, responsive card grid

Note on live scraping: The codebase includes a live-search module that can scrape AllRecipes.com in real time and cache results locally. This works when running the app on your own machine, but AllRecipes blocks data-centre IPs, so the deployed Streamlit Cloud version relies entirely on the pre-seeded database.


How It Works

User searches "chicken tikka"
        │
        ▼
┌──────────────────────────────┐     found?     ┌────────────────────┐
│  Local SQLite DB             │──── yes ──────▶│  Display results   │
│  (~2,000 pre-seeded recipes) │                └────────────────────┘
└──────────────────────────────┘
        │ no (local only)
        ▼
┌──────────────────────────┐        ┌────────────────────┐
│ Scrape AllRecipes.com    │───────▶│ Store in SQLite &   │
│ (works locally, blocked  │        │ display results     │
│  on cloud deployments)   │        └────────────────────┘
└──────────────────────────┘

User clicks "View Recipe" → sees ingredients + instructions
User asks "I don't have heavy cream" →
        │
        ▼
┌──────────────────────────┐        ┌────────────────────┐
│ Google Gemini API        │───────▶│ Structured JSON     │
│ (gemini-2.5-flash)       │        │ substitution cards  │
└──────────────────────────┘        └────────────────────┘

Tech Stack

  • Python 3.13
  • Streamlit - web app framework (UI, routing, session state)
  • recipe-scrapers - extracts structured data from recipe URLs
  • BeautifulSoup4 + lxml - parses AllRecipes search result pages
  • google-genai - Google Gemini AI SDK for ingredient substitutions
  • SQLite - local database (via Python's built-in sqlite3)
  • python-dotenv - loads API keys from .env
  • requests - HTTP client for scraping

Project Structure

munchr/
├── app/
│   └── streamlit_app.py      # Streamlit web app (UI, styling, session state)
├── scraper/
│   └── recipe_scraper.py     # Recipe scraping, SQLite database, search logic
├── ai/
│   └── gemini_assistant.py   # Gemini AI ingredient substitution assistant
├── seeds/
│   ├── seed_urls.py          # 24 curated AllRecipes URLs for starter seeding
│   └── bulk_seed.py          # Bulk seeder - 186 search terms, ~2,000 recipes
├── data/
│   ├── recipes.db            # SQLite database (~2,000 pre-seeded recipes)
│   └── sample_output.json    # Example recipe JSON structure
├── docs/                     # Screenshot images for README
├── .env                      # API key (not committed - see .env.example)
├── .env.example              # Template for environment variables
├── .gitignore
├── requirements.txt
├── reflection.md
└── README.md

Setup & Installation

Prerequisites

1. Clone the repository

git clone https://github.com/gunmentoy/munchr.git
cd munchr

2. Create a virtual environment

python3 -m venv venv
source venv/bin/activate        # macOS / Linux
# venv\Scripts\activate         # Windows

3. Install dependencies

pip install -r requirements.txt

4. Add your API key

cp .env.example .env

Open .env and replace the placeholder with your actual Gemini API key:

GEMINI_API_KEY=your_actual_key_here

5. Run the app

streamlit run app/streamlit_app.py

The app will open in your browser at http://localhost:8501.

The repo ships with a pre-seeded SQLite database of ~2,000 recipes, so the app is ready to use immediately.

(Optional) Re-seed the database

If you want to start fresh or update the recipe collection:

Quick seed (24 curated recipes):

python -m scraper.recipe_scraper

Bulk seed (~2,000 recipes across 186 diverse search terms - takes ~30 min):

python seeds/bulk_seed.py

Data Sources

  • AllRecipes.com - all recipe data (titles, ingredients, instructions, images, cook times) was scraped from allrecipes.com using the recipe-scrapers library and BeautifulSoup, then pre-seeded into the included SQLite database
  • Google Gemini AI - ingredient substitution suggestions are generated at runtime by Gemini 2.5 Flash via the google-genai SDK

AI Use Statement

This project was developed with the assistance of GitHub Copilot (Claude Sonnet 4.6) for debugging and documentation. The AI assistant was used as an assistant throughout development - all code was reviewed and tested by the developer.

Google Gemini 2.5 Flash is used at runtime to generate ingredient substitution suggestions based on recipe context and user queries.


Known Limitations

  • No live search on cloud - AllRecipes.com blocks requests from data-centre IPs, so the Streamlit Cloud deployment searches only the pre-seeded database; live scraping works when running locally
  • AllRecipes only - recipe data is sourced exclusively from allrecipes.com; other recipe sites are not supported
  • Scraping fragility - if AllRecipes changes their HTML structure, the scraper may need updating
  • AI accuracy - Gemini substitution suggestions are AI-generated and may not always be perfect; use your own culinary judgment
  • No user accounts - recipes are stored in SQLite; there are no user profiles or saved favourites
  • Rate limits - both AllRecipes scraping and Gemini API calls are subject to rate limits on heavy use

License

This project was created for academic purposes at BCIT.

About

AI-powered recipe search and cooking assistant. Built with Python, Streamlit, and BeautifulSoup. Powered by Google Gemini

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages