Adapt-a-dish is an AI-powered recipe transformation assistant that customizes recipes based on dietary preferences, skill level, and serving size. Whether you're vegan, gluten-free, or exploring healthier options, Adapt-a-dish adapts your favorite recipes into personalized culinary masterpieces.
It uses a fine-tuned Vision Transformer (ViT) model with LoRA (Low-Rank Adaptation) for image-based recognition and incorporates user-defined contexts (e.g., "vegan", "low-calorie") to customize recipe results. The app fetches recipe data using the Tavily search API and generates detailed recipes through a LLaMA model accessed via the Groq API. For customizing recipes, the system uses ChromaDB and Ollama for ingredient substitution and recipe transformation.
- Image-Based Dish Recognition: Upload an image to identify a dish using a fine-tuned ViT model with LoRA.
- Text-Based Dish Input: Input a dish name directly for recipe generation.
- Context-Aware Filtering: Customize recipes with specific dietary contexts:
- Vegan
- Low-calorie
- High-protein, etc.
- Recipe Generation: Generates recipes with ingredients and step-by-step instructions using Tavily's search API and LLaMA 3.1 provided by the Groq API.
- User-Friendly Interface: Simple and interactive frontend developed in Angular.
- Ingredient Substitution: Uses ChromaDB for finding suitable ingredient replacements.
- Recipe Transformation: Ollama is used for transforming recipes based on dietary preferences and skill level.
-
User Input:
- Provide the dish name, dietary preferences (e.g., vegan, gluten-free), serving size, and a recipe to adapt.
-
AI Query:
- The system uses the provided dish name and preferences to retrieve substitution ideas and context.
-
Recipe Transformation:
- The recipe is adjusted with dietary-friendly ingredients and cooking instructions tailored to the skill level.
-
Output:
- The system generates a personalized recipe with detailed ingredients and instructions.
- Backend:
- FastAPI, Ollama, ChromaDB, PyTorch, LangChain, Transformers, Torchvision
- Frontend:
- Framework: Angular
- APIs:
- Tavily API: For finding relevant recipes.
- Groq API (LLaMA): For generating detailed recipe content.
- Dependencies:
torch
,transformers
,langchain
,fastapi
,pydantic
,torchvision
,ollama
,chromadb
, etc.
-
Clone the Repository:
git clone https://github.com/Atul-AI08/Context-Aware-Recipe-Generator.git cd Context-Aware-Recipe-Generator
-
Finetune ViT: Ensure Python 3.8+ is installed along with required libraries, then run:
cd backend/vit/ python finetune_vit.py
Dataset Used: The-massive-Indian-Food-Dataset
-
Set Up APIs: Create API keys for Tavily and Groq
-
Run the Backend:
cd backend/vit/ python dish_detect.py cd ../generation/ ollama serve python main.py
-
Run the Frontend: Navigate to the Angular project directory and start the development server:
cd frontend npm i ng serve
Example of image upload for dish recognition.
Interface for selecting dietary preferences.
Generated recipe with ingredients and instructions.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Fork the repository and submit a pull request for review.