A modern, AI-powered recipe generation web application that creates personalized recipes with images and learning resources. Built with FastAPI, OpenAI GPT, and a responsive web interface.
- AI-Powered Recipe Generation: Utilizes OpenAI GPT-3.5 to create detailed, personalized recipes
- Dynamic Image Generation: Creates appetizing food images using DALL-E 3
- Dietary Preferences: Supports various dietary requirements (vegetarian, vegan, gluten-free, keto)
- Cuisine Types: Multiple cuisine options (Italian, Mexican, Indian, Chinese, Japanese)
- Markdown Formatting: Beautiful, well-structured recipe presentation
- Responsive Design: Modern UI that works on all devices
- Real-time Generation: Instant recipe creation with loading states
- Error Handling: Comprehensive error management and user feedback
- Framework: FastAPI
- AI Integration: OpenAI API (GPT-3.5 & DALL-E 3)
- Language: Python 3.11+
- Key Libraries:
openai: AI model integrationpydantic: Data validationpython-dotenv: Environment managementuvicorn: ASGI server
- HTML5 with modern features
- TailwindCSS for styling
- AlpineJS for interactivity
- Marked.js for markdown rendering
-
Clone the repository
git clone https://github.com/rohitg00/ai-food-recipe-assistant.git cd ai-food-recipe-assistant -
Set up Python environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Configure environment variables
cp .env.example .env # Edit .env and add your OpenAI API key: # OPENAI_API_KEY=your_api_key_here
-
Run the application
uvicorn main:app --reload
-
Access the application
- Open
http://localhost:8080in your browser
- Open
-
User Input
- User enters recipe query
- Optionally selects dietary preferences and cuisine type
- Frontend validates input before submission
-
Recipe Generation
- Backend receives request and validates parameters
- OpenAI GPT-3.5 generates recipe in markdown format:
- Brief description
- Ingredients list
- Step-by-step instructions
- Cooking tips
- Nutritional information
-
Image Generation
- DALL-E 3 creates a photorealistic image of the recipe
- Image is optimized and cached for performance
-
Response Processing
- Recipe is formatted and structured
- Frontend renders markdown content
- Image is displayed with loading states
- Error handling manages API failures gracefully
Generates a new recipe with image
Request Body:
{
"query": "string",
"diet_preference": "string | null",
"cuisine_type": "string | null"
}Response:
{
"recipe": "string (markdown)",
"image_url": "string",
"learning_resources": [
{
"type": "string",
"title": "string",
"url": "string"
}
]
}- API keys stored securely in environment variables
- Input validation at multiple levels
- CORS middleware implemented
- No sensitive information exposed to frontend
- Recipe saving and sharing functionality
- User accounts and preferences
- Advanced filtering options
- Ingredient substitution suggestions
- Integration with shopping lists
- Mobile app version
- Recipe rating system
- Social sharing features
MIT License - feel free to use this project for learning and development!
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
For support, please open an issue in the GitHub repository or contact the maintainers.
Made with ❤️ by Rohit Ghumare
