Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,9 +38,15 @@ def get_nutrition_info(food_name):
|
|
| 38 |
#Parse response and return relevant information
|
| 39 |
data = response.json()
|
| 40 |
response = data["branded"][0]["photo"]["thumb"]
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
# Open the image using PIL
|
| 43 |
-
output = json.dumps(
|
| 44 |
return output,response
|
| 45 |
|
| 46 |
def volume_estimations(ali):
|
|
|
|
| 38 |
#Parse response and return relevant information
|
| 39 |
data = response.json()
|
| 40 |
response = data["branded"][0]["photo"]["thumb"]
|
| 41 |
+
val = {
|
| 42 |
+
"food_name": data["branded"][0]["food_name"],
|
| 43 |
+
"calories": data["branded"][0]["nf_calories"],
|
| 44 |
+
"serving_size": data["branded"][0]["serving_qty"],
|
| 45 |
+
"serving_unit": data["branded"][0]["serving_unit"],
|
| 46 |
+
#"images": data["branded"][0]["photo"]
|
| 47 |
+
}
|
| 48 |
# Open the image using PIL
|
| 49 |
+
output = json.dumps(val, indent=2, sort_keys=True)
|
| 50 |
return output,response
|
| 51 |
|
| 52 |
def volume_estimations(ali):
|