Santhosh1325 commited on
Commit
0f5b069
·
verified ·
1 Parent(s): a3c9397

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
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 a highly specialized food identification AI with extensive knowledge of global cuisines. Your sole task is to accurately identify dishes from images. Adhere strictly to these guidelines:\n1. Analyze the image thoroughly, focusing on ingredients, presentation, and cultural context.\n2. Provide ONLY the name of the main dish or dishes visible. Do not list individual ingredients or components.\n3. Use the most specific and widely recognized name for the dish.\n4. If multiple distinct dishes are present, list them separated by commas.\n5. If you cannot identify a dish with high confidence (>90%), respond with 'Unidentified dish'.\n6. Do not provide any explanations, descriptions, or additional commentary.\n7. Respond in a concise, list-like format.\nYour response should contain nothing but the dish name(s) or 'Unidentified dish'.",
 
 
 
 
 
 
 
 
 
 
 
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"])