Skip to content

The Recipe Chatbot is an AI-driven assistant offering personalized recipe suggestions, ingredient substitutions, and cooking tips. Powered by advanced technologies like RAG and HuggingFace, it provides seamless, interactive culinary support through a user-friendly Streamlit interface.

Notifications You must be signed in to change notification settings

neeeringute/WBS_Coding_School_Data_Science_Project_Recipe-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍴 Recipe Chatbot: Your AI-Powered Culinary Assistant

img

The Recipe Chatbot is an advanced AI-powered tool developed in Google Colab to assist users in the kitchen. Whether you're looking for recipes, ingredient substitutions, or tips on cooking techniques, this chatbot provides instant, accurate, and context-aware answers. It uses cutting-edge technologies like Retrieval-Augmented Generation (RAG), HuggingFace models, Groq APIs, and large language models (LLMs) to deliver an interactive and seamless experience.


📋 Key Features

  • Recipe Suggestions: Based on ingredients, preferences, or user queries.
  • Ingredient Substitutions: Offers alternatives for unavailable ingredients.
  • Cooking Tips: Provides guidance on various culinary techniques and methods.
  • Custom Measurement Conversions: Automatically converts units (e.g., ounces to grams, Fahrenheit to Celsius).
  • Interactive Chat Interface: User-friendly interface for engaging conversations with the chatbot.
  • Data Organization: Recipes are categorized for quick and efficient retrieval.

🛠️ Technologies Used

Development Environment

  • Google Colab: Used for scripting, testing, and prototyping the chatbot functionalities.

Data Extraction and Preparation

  • PyPDF2 & PyMuPDF: Extract recipe data and related text from PDF files.
  • JSON Conversion: Extracted data from the PDF is structured and converted into a JSON file for efficient access and management.
  • FAISS (Facebook AI Similarity Search): Efficient vector-based document storage and retrieval.
  • LangChain: Framework for building conversational AI with structured workflows.

Conversational AI

  • HuggingFace Models:
    • Embeddings: Semantic search using sentence-transformers/all-MiniLM-l6-v2.
    • Language Models: Generating natural, context-aware responses.
  • Groq APIs: Handles conversational capabilities and advanced AI integration.
  • Large Language Models (LLMs): Mistral-7B-Instruct for high-quality text generation.

Deployment and Interface

  • Streamlit: Builds an interactive web-based interface for the chatbot.
  • Localtunnel: Allows public access to the chatbot via secure URLs.

📂 Project Workflow

1. Development in Google Colab

Google Colab served as the primary environment for:

  • Extracting recipe data from a PDF using PyPDF2 and PyMuPDF.
  • Converting the extracted PDF data into a JSON file for structured access and reuse.
  • Categorizing recipes into structured formats like soups, desserts, and vegetarian options.
  • Testing and refining conversational logic using LangChain and FAISS.

2. Data Preparation

Recipes are extracted from a PDF recipe book and converted to JSON. This structured data includes:

  • Recipe Categories: Organized into types like soups, desserts, and vegetarian.
  • Measurement Conversions: E.g., "1 oz = 28.35 g".
  • Cooking Tips: Guidelines for freezing, defrosting, and food safety.

The JSON data is further stored in a FAISS vector database for fast and accurate retrieval.

3. Conversational Retrieval

The chatbot uses LangChain’s Conversational Retrieval Chain, which combines:

  • Semantic search with HuggingFace embeddings.
  • Context-aware responses powered by Groq APIs and LLMs.

4. Chatbot Interaction

The chatbot is deployed via Streamlit, allowing users to:

  • Query recipes based on ingredients.
  • Get real-time substitutions for missing ingredients.
  • Learn cooking techniques or ask for tips.

🚀 Getting Started

Prerequisites

  • Python 3.7 or higher
  • Installed dependencies: PyPDF2, pymupdf, gradio, faiss-cpu, langchain

Installation

  1. Clone the Repository:
    git clone <repository-url>
    cd recipe-chatbot
    
  2. Install Dependencies:
    pip install -r requirements.txt
    
  3. Prepare the Data:
  • Place the recipe book PDF in the /content directory of Google Colab.
  • Update the file path in the script if necessary.
  1. Extract and Convert Recipes: Run the script in Google Colab to process the PDF and convert it into a structured JSON file:
    python extract_recipes.py
    
  2. Launch the Chatbot: Start the Streamlit application:
    streamlit run rag_app.py
  3. Access the Chatbot:
  • Use the local URL provided by Streamlit.
  • If hosted remotely, the public URL will be generated by Localtunnel.

🌟 Example Interaction

User Input:

"What can I make with tomatoes and basil?"

Chatbot Response:

About

The Recipe Chatbot is an AI-driven assistant offering personalized recipe suggestions, ingredient substitutions, and cooking tips. Powered by advanced technologies like RAG and HuggingFace, it provides seamless, interactive culinary support through a user-friendly Streamlit interface.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published