Food_Manu_Frontend / README.md
Jack1808's picture
Upload folder using huggingface_hub
38caa61 verified
---
title: Food Manu Frontend
emoji: πŸ†
colorFrom: red
colorTo: gray
sdk: docker
pinned: false
license: mit
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# 🍽️ Menu Extractor & Food Image Generator
An AI-powered web application that extracts menu items from restaurant menu images and generates beautiful food images for each item using advanced machine learning models.
## 🌟 Features
- **πŸ“Έ Menu Image Upload**: Upload menu images or capture them directly using your camera
- **πŸ€– AI Menu Extraction**: Uses Google's Gemini AI to extract menu items, descriptions, and prices
- **🎨 Food Image Generation**: Generates high-quality food images using Stable Diffusion
- **πŸ’» Beautiful Frontend**: Modern, responsive web interface with live preview
- **πŸ“± Mobile Friendly**: Works seamlessly on desktop and mobile devices
- **πŸ”„ Code Generation**: Automatically generates clean HTML code for the extracted menu
## πŸš€ Demo
Try the live demo: [Menu Extractor & Food Generator](https://huggingface.co/spaces/your-username/menu-extractor)
## πŸ› οΈ Technology Stack
- **Backend**: Flask (Python)
- **AI Models**:
- Google Gemini 1.5 Flash (Menu extraction)
- Stable Diffusion v1.5 (Image generation)
- **Frontend**: HTML, CSS, JavaScript
- **Image Processing**: Pillow (PIL)
- **Deployment**: Hugging Face Spaces
## πŸ“‹ Requirements
- Python 3.9+
- CUDA-compatible GPU (recommended for faster image generation)
- Google Gemini API key
## πŸ”§ Installation
1. Clone the repository:
```bash
git clone https://github.com/your-username/menu-extractor.git
cd menu-extractor
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up environment variables:
Create a `.env` file and add your Gemini API key:
```
GEMINI_API_KEY=your_gemini_api_key_here
```
4. Run the application:
```bash
python app.py
```
5. Open your browser and navigate to `http://localhost:7860`
## 🌐 Deployment on Hugging Face Spaces
1. Create a new Space on [Hugging Face Spaces](https://huggingface.co/spaces)
2. Choose "Docker" as the SDK
3. Upload the following files:
- `app.py`
- `templates/index.html`
- `Dockerfile`
- `requirements.txt`
- `README.md`
4. Add your `GEMINI_API_KEY` in the Space settings under "Variables and secrets"
5. Your app will be automatically deployed!
## πŸ“– How to Use
1. **Upload Image**: Choose to upload a menu image from your device or take a photo using your camera
2. **Extract Menu**: Click "Extract Menu Items" to process the image with AI
3. **View Results**: See the beautiful menu layout with generated food images
4. **Get Code**: Switch to code view to copy the generated HTML for your own use
## 🎯 Use Cases
- **Restaurant Owners**: Quickly digitize physical menus
- **Web Developers**: Generate menu websites for restaurant clients
- **Food Bloggers**: Create visual menu content
- **Menu Design**: Prototype digital menu layouts
## πŸ”‘ API Keys Setup
### Google Gemini API
1. Visit [Google AI Studio](https://makersuite.google.com/)
2. Create a new API key
3. Add it to your environment variables as `GEMINI_API_KEY`
## ⚑ Performance Notes
- **CPU Mode**: Image generation will be slower but still functional
- **GPU Mode**: Significantly faster image generation with CUDA-compatible GPU
- **Memory**: Requires ~4GB RAM for optimal performance
## πŸ› Troubleshooting
### Common Issues:
1. **Model Loading Error**: Ensure you have sufficient disk space and memory
2. **API Key Error**: Verify your Gemini API key is correctly set
3. **Image Processing Error**: Check that uploaded images are in supported formats (JPG, PNG)
## πŸ“„ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 🀝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the project
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## πŸ™ Acknowledgments
- [Google Gemini](https://deepmind.google/technologies/gemini/) for menu extraction
- [Stable Diffusion](https://stability.ai/) for food image generation
- [Hugging Face](https://huggingface.co/) for hosting and deployment
- [Flask](https://flask.palletsprojects.com/) for the web framework
## πŸ“ž Support
If you encounter any issues or have questions, please [open an issue](https://github.com/your-username/menu-extractor/issues) on GitHub.
---
Made with ❀️ by [Your Name](https://github.com/your-username)