Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,18 @@ def identify_dish(image_bytes):
|
|
16 |
model="meta-llama/Llama-3.2-11B-Vision-Instruct",
|
17 |
messages=[
|
18 |
{
|
19 |
-
"role": "You are
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
"content": [
|
21 |
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{encoded_image}"}},
|
22 |
{"type": "text", "text": "Identify the dishes in the image and return only the names of the dishes."},
|
@@ -102,6 +113,7 @@ def generate_diet_plan(dish_name, calorie_intake_per_day, goal):
|
|
102 |
|
103 |
# Streamlit App Title
|
104 |
st.title("AI Diet Recommender")
|
|
|
105 |
|
106 |
# Sidebar navigation to switch between the app and the user guide
|
107 |
menu = st.sidebar.selectbox("Menu", ["App", "User Guide"])
|
|
|
16 |
model="meta-llama/Llama-3.2-11B-Vision-Instruct",
|
17 |
messages=[
|
18 |
{
|
19 |
+
"role": """You are an advanced food identification AI with in-depth knowledge of global cuisines, regional dishes, and culinary trends. Your task is to identify dishes from images with the highest accuracy possible. Follow these enhanced instructions for optimal performance:
|
20 |
+
|
21 |
+
Analyze the image thoroughly, considering ingredients, plating style, cultural origin, and any visible clues.
|
22 |
+
Always provide the most specific and widely recognized name of the dish or dishes visible.
|
23 |
+
If an exact match is not possible, return the closest likely match based on the visual details, even if it is a variation (e.g., "Vegetable Biryani" instead of "Mixed Veg Rice").
|
24 |
+
Use synonyms or localized names if relevant to improve identification (e.g., "Aubergine" or "Eggplant").
|
25 |
+
If multiple distinct dishes are present, list them separated by commas.
|
26 |
+
If you are uncertain about a dish but still identify it with reasonable confidence (80-90%), respond with the closest guess and indicate it as a possible match (e.g., "Possible: Paella").
|
27 |
+
If you cannot identify the dish at all, respond with 'Unidentified dish'.
|
28 |
+
Do not include individual ingredients, explanations, or commentary.
|
29 |
+
Respond only with the dish name(s) or 'Unidentified dish' in a list format.""",
|
30 |
+
|
31 |
"content": [
|
32 |
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{encoded_image}"}},
|
33 |
{"type": "text", "text": "Identify the dishes in the image and return only the names of the dishes."},
|
|
|
113 |
|
114 |
# Streamlit App Title
|
115 |
st.title("AI Diet Recommender")
|
116 |
+
st.write("Note : The Dish Identification model Might do some Mistakes")
|
117 |
|
118 |
# Sidebar navigation to switch between the app and the user guide
|
119 |
menu = st.sidebar.selectbox("Menu", ["App", "User Guide"])
|