oKurto commited on
Commit
c53596c
·
verified ·
1 Parent(s): a7ef627

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +122 -0
README.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ title: FoodFiles
4
+ sdk: gradio
5
+ ---
6
+ # FoodFiles - AI-Powered Recipe Generator
7
+
8
+ FoodFiles is a comprehensive web application demonstrating modern AI capabilities in culinary applications. Using computer vision and multiple AI models, it analyzes food images to generate detailed potential recipes, nutritional information, cost estimates, and professional menu descriptions.
9
+
10
+ The application is intentionally structured as a single module to showcase CSS integration patterns and function interactions, making it an excellent learning resource for developers. Powered by Groq's fast inference capabilities and developed by Kurt Overmier at SmartBrandStrategies.com, this project serves as both a functional tool and educational reference.
11
+
12
+ ## Features
13
+
14
+ - Image Analysis: Detailed analysis of food images identifying ingredients, cooking techniques, and presentation
15
+ - Recipe Generation: Complete recipes with ingredients, instructions, and variations
16
+ - Nutritional Information: Detailed nutrition facts label with daily value percentages
17
+ - Cost Estimation: Ingredient cost breakdown and total recipe cost
18
+ - Menu Description: Restaurant-style dish descriptions
19
+ - Progress Tracking: Real-time progress indicators during generation
20
+ - Mobile-Friendly Interface: Responsive design that works on all devices
21
+ - Secure API Key Handling: Input your Groq API key directly in the interface
22
+
23
+ ## Prerequisites
24
+
25
+ - Python 3.7+
26
+ - Required Python packages:
27
+ - groq
28
+ - gradio
29
+ - Pillow
30
+
31
+ ## Installation
32
+
33
+ 1. Clone the repository:
34
+ ```bash
35
+ git clone https://github.com/yourusername/foodfiles.git
36
+ cd foodfiles
37
+ ```
38
+
39
+ 2. Install dependencies:
40
+ ```bash
41
+ pip install -r requirements.txt
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ 1. Start the application:
47
+ ```bash
48
+ python recipe_generator.py
49
+ ```
50
+
51
+ 2. Open your browser and navigate to `http://127.0.0.1:7860`
52
+
53
+ 3. Get your Groq API key:
54
+ - Visit Groq Console
55
+ - Sign up or log in
56
+ - Go to API Keys section
57
+ - Create a new API key
58
+
59
+ 4. Enter your Groq API key in the application interface
60
+ 5. Upload an image of a dish
61
+ 6. Click "Generate Recipe" to analyze the image and generate results
62
+
63
+ ## API Models Used
64
+
65
+ - `llama-3.2-11b-vision-preview`: Image analysis
66
+ - `mixtral-8x7b-32768`: Recipe generation
67
+ - `llama3-8b-8192`: Nutritional analysis
68
+ - `llama-3.1-8b-instant`: Cost estimation and menu descriptions
69
+
70
+ ## Configuration
71
+
72
+ Key configuration constants in `recipe_generator.py`:
73
+ ```python
74
+ MAX_RETRIES = 5
75
+ IMAGE_RESIZE_FACTOR = 1
76
+ IMAGE_QUALITY = 85
77
+ MAX_TOKENS = {
78
+ 'analysis': 750,
79
+ 'recipe': 2000,
80
+ 'nutrition': 1000,
81
+ 'menu': 300,
82
+ 'cost': 1000
83
+ }
84
+ ```
85
+
86
+ ## Error Handling
87
+
88
+ - Automatic retry logic for API calls
89
+ - Exponential backoff between retries
90
+ - Comprehensive error logging
91
+ - User-friendly error messages in the interface
92
+ - API key validation and status feedback
93
+
94
+ ## Development
95
+
96
+ The application uses:
97
+
98
+ - Gradio for the web interface
99
+ - PIL for image processing
100
+ - Custom CSS for nutrition label styling
101
+ - Markdown formatting for recipe output
102
+ - Regex for recipe parsing
103
+ - JSON mode for structured data handling
104
+
105
+ ## Contributing
106
+
107
+ 1. Fork the repository
108
+ 2. Create a feature branch
109
+ 3. Commit your changes
110
+ 4. Push to the branch
111
+ 5. Create a Pull Request
112
+
113
+ ## License
114
+
115
+ This project is licensed under the MIT License - see the [MIT](LICENSE) file for details.
116
+
117
+ Copyright (c) 2024 SmartBrandStrategies.com - Kurt Overmier
118
+
119
+ ## Acknowledgments
120
+
121
+ - Powered by Groq for fast inference
122
+ - Built with Gradio