Santhosh54321 commited on
Commit
e906233
·
verified ·
1 Parent(s): 7d1bfcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -18,7 +18,7 @@ def identify_dish(image_bytes):
18
  model="meta-llama/Llama-3.2-11B-Vision-Instruct",
19
  messages=[
20
  {
21
- "role": "You are a highly specialized food identification AI...",
22
  "content": [
23
  {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{encoded_image}" }},
24
  {"type": "text", "text": "Identify the dishes in the image and return only the names of the dishes."},
@@ -81,7 +81,7 @@ def calculate_metrics(age, gender, height_cm, weight_kg, weight_goal, activity_l
81
  # 3. Function to generate diet plan
82
  def generate_diet_plan(dish_name, calorie_intake_per_day, goal):
83
  user_input = f"""
84
- You are a certified Dietitian with 20 years of experience. Based on the following input, create an Indian diet plan...
85
 
86
  Input:
87
  - Dish Name: {dish_name}
@@ -104,9 +104,9 @@ def generate_recipe(recipe_name):
104
  "Content-Type": "application/json"
105
  }
106
  data = {
107
- "model": "gpt-3.5-turbo",
108
  "messages": [
109
- {"role": "system", "content": "You are a skilled chef."},
110
  {"role": "user", "content": f"Create a detailed recipe for {recipe_name}"}
111
  ]
112
  }
 
18
  model="meta-llama/Llama-3.2-11B-Vision-Instruct",
19
  messages=[
20
  {
21
+ "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'.",
22
  "content": [
23
  {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{encoded_image}" }},
24
  {"type": "text", "text": "Identify the dishes in the image and return only the names of the dishes."},
 
81
  # 3. Function to generate diet plan
82
  def generate_diet_plan(dish_name, calorie_intake_per_day, goal):
83
  user_input = f"""
84
+ You are a certified Dietitian with 20 years of experience. Based on the following input, create an Indian diet plan that fits within the calculated calorie intake and assesses if the given dish is suitable for the user's goal.
85
 
86
  Input:
87
  - Dish Name: {dish_name}
 
104
  "Content-Type": "application/json"
105
  }
106
  data = {
107
+ "model": "llama-3.1-70b-versatile",
108
  "messages": [
109
+ {"role": "system", "content": "You are a skilled chef with 10 years of experience."},
110
  {"role": "user", "content": f"Create a detailed recipe for {recipe_name}"}
111
  ]
112
  }