Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -111,17 +111,17 @@ async def predict_image_and_nutrition(file: UploadFile = File(...)):
|
|
| 111 |
|
| 112 |
# return {"predicted_label": prediction, "nutrition_info": response}
|
| 113 |
|
| 114 |
-
nutrition_prompt = f"
|
| 115 |
nutrition_info = call_llm(llm_client, nutrition_prompt)
|
| 116 |
|
| 117 |
-
# Second prompt:
|
| 118 |
-
|
| 119 |
-
|
| 120 |
|
| 121 |
return {
|
| 122 |
"predicted_label": prediction,
|
| 123 |
"nutrition_info": nutrition_info,
|
| 124 |
-
"
|
| 125 |
}
|
| 126 |
except Exception as e:
|
| 127 |
return JSONResponse(
|
|
|
|
| 111 |
|
| 112 |
# return {"predicted_label": prediction, "nutrition_info": response}
|
| 113 |
|
| 114 |
+
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} in a formatted list only."
|
| 115 |
nutrition_info = call_llm(llm_client, nutrition_prompt)
|
| 116 |
|
| 117 |
+
# Second prompt: Health benefits and tips
|
| 118 |
+
health_benefits_prompt = f"Provide the health benefits and considerations for {prediction} and give tips for making it healthier."
|
| 119 |
+
health_benefits_and_tips = call_llm(llm_client, health_benefits_prompt)
|
| 120 |
|
| 121 |
return {
|
| 122 |
"predicted_label": prediction,
|
| 123 |
"nutrition_info": nutrition_info,
|
| 124 |
+
"health_benefits_and_tips": health_benefits_and_tips
|
| 125 |
}
|
| 126 |
except Exception as e:
|
| 127 |
return JSONResponse(
|