1MR commited on
Commit
0eb6b6c
·
verified ·
1 Parent(s): f817e2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -114,19 +114,19 @@ async def predict_image_and_nutrition(file: UploadFile = File(...)):
114
  # return {"predicted_label": prediction, "nutrition_info": response}
115
 
116
  # nutrition_prompt = f"Provide the nutrition information (Calories, Protein, Carbohydrates, Dietary Fiber, Sugars, Fat, Sodium, Potassium, Vitamin C, Vitamin B6, Folate, Niacin, Pantothenic acid) for {prediction} per 100 grams in a formatted list only."
117
- # nutrition_prompt = f"Provide the nutrition information (Calories, Protein, Carbohydrates, Dietary Fiber, Sugars, Fat, Sodium, Potassium, Vitamin C, Vitamin B6) for {prediction} per 100 grams, Output the information as a concise, formatted list without repetition."
118
- # nutrition_info = call_llm(llm_client, nutrition_prompt)
119
 
120
  # # Second prompt: Health benefits and tips
121
- # health_benefits_prompt = f"Provide the health benefits and considerations for {prediction}. Additionally, include practical tips for making {prediction} healthier. Keep the response focused on these two aspects only."
122
- health_benefits_prompt = f"Provide detailed information about {prediction}, including its origin, common uses, cultural significance, and any interesting facts. Keep the response informative and well-structured."
123
 
124
  Information = call_llm(llm_client, health_benefits_prompt)
125
 
126
  return {
127
  "predicted_label": prediction,
128
- "Information": Information,
129
- # "nutrition_info": nutrition_info
130
  }
131
  except Exception as e:
132
  return JSONResponse(
 
114
  # return {"predicted_label": prediction, "nutrition_info": response}
115
 
116
  # nutrition_prompt = f"Provide the nutrition information (Calories, Protein, Carbohydrates, Dietary Fiber, Sugars, Fat, Sodium, Potassium, Vitamin C, Vitamin B6, Folate, Niacin, Pantothenic acid) for {prediction} per 100 grams in a formatted list only."
117
+ nutrition_prompt = f"Provide the nutrition information (Calories, Protein, Carbohydrates, Dietary Fiber, Sugars, Fat, Sodium, Potassium, Vitamin C, Vitamin B6) for {prediction} per 100 grams, Output the information as a concise, formatted list without repetition."
118
+ nutrition_info = call_llm(llm_client, nutrition_prompt)
119
 
120
  # # Second prompt: Health benefits and tips
121
+ health_benefits_prompt = f"Provide the health benefits and considerations for {prediction}. Additionally, include practical tips for making {prediction} healthier. Keep the response focused on these two aspects only."
122
+ # health_benefits_prompt = f"Provide detailed information about {prediction}, including its origin, common uses, cultural significance, and any interesting facts. Keep the response informative and well-structured."
123
 
124
  Information = call_llm(llm_client, health_benefits_prompt)
125
 
126
  return {
127
  "predicted_label": prediction,
128
+ "nutrition_info": nutrition_info,
129
+ "Information": Information
130
  }
131
  except Exception as e:
132
  return JSONResponse(