Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,22 +56,6 @@ nutritional_data = {
|
|
| 56 |
}
|
| 57 |
}
|
| 58 |
|
| 59 |
-
def display_dishes_in_city(city):
|
| 60 |
-
"""Displays all dishes available in the selected city with their nutritional information and cost."""
|
| 61 |
-
result_str = f"### Available Dishes in {city} (Data pulled from leading food aggregators):\n"
|
| 62 |
-
for dish, info in nutritional_data.items():
|
| 63 |
-
result_str += f"- **{dish}**\n"
|
| 64 |
-
result_str += f" - Cost: ₹{info[city]}\n"
|
| 65 |
-
result_str += f" - Energy: {info['Energy (kcal)']} kcal\n"
|
| 66 |
-
result_str += f" - Protein: {info['Protein (g)']} g\n"
|
| 67 |
-
result_str += f" - Fat: {info['Fat (g)']} g\n"
|
| 68 |
-
result_str += f" - Carbohydrate: {info['Carbohydrate (g)']} g\n"
|
| 69 |
-
result_str += f" - Fiber: {info['Fiber (g)']} g\n"
|
| 70 |
-
result_str += f" - Calcium: {info['Calcium (mg)']} mg\n"
|
| 71 |
-
result_str += f" - Iron: {info['Iron (mg)']} mg\n"
|
| 72 |
-
result_str += f" - Vitamin C: {info['Vitamin C (mg)']} mg\n\n"
|
| 73 |
-
return result_str
|
| 74 |
-
|
| 75 |
def optimize_dishes_for_budget(city, daily_budget):
|
| 76 |
# Extracting cost, calories, and protein data for the selected city
|
| 77 |
costs = [nutritional_data[dish][city] for dish in nutritional_data]
|
|
@@ -103,17 +87,10 @@ def optimize_dishes_for_budget(city, daily_budget):
|
|
| 103 |
for dish, qty in zip(selected_dishes, quantities):
|
| 104 |
if qty > 1e-5:
|
| 105 |
result_str += f"- **{qty:.2f} portions of {dish}** at ₹{nutritional_data[dish][city]} per portion\n"
|
| 106 |
-
|
| 107 |
# Add detailed information about each selected dish
|
| 108 |
result_str += f" - Total Cost: ₹{nutritional_data[dish][city] * qty:.2f}\n"
|
| 109 |
result_str += f" - Total Energy: {nutritional_data[dish]['Energy (kcal)'] * qty:.2f} kcal\n"
|
| 110 |
-
result_str += f" - Total Protein: {nutritional_data[dish]['Protein (g)'] * qty:.2f} g\n"
|
| 111 |
-
result_str += f" - Total Fat: {nutritional_data[dish]['Fat (g)'] * qty:.2f} g\n"
|
| 112 |
-
result_str += f" - Total Carbohydrate: {nutritional_data[dish]['Carbohydrate (g)'] * qty:.2f} g\n"
|
| 113 |
-
result_str += f" - Total Fiber: {nutritional_data[dish]['Fiber (g)'] * qty:.2f} g\n"
|
| 114 |
-
result_str += f" - Total Calcium: {nutritional_data[dish]['Calcium (mg)'] * qty:.2f} mg\n"
|
| 115 |
-
result_str += f" - Total Iron: {nutritional_data[dish]['Iron (mg)'] * qty:.2f} mg\n"
|
| 116 |
-
result_str += f" - Total Vitamin C: {nutritional_data[dish]['Vitamin C (mg)'] * qty:.2f} mg\n\n"
|
| 117 |
|
| 118 |
result_str += f"\n### Total Cost: ₹{total_cost:.2f}\n"
|
| 119 |
result_str += f"### Total Calories: {total_calories:.2f} kcal\n"
|
|
|
|
| 56 |
}
|
| 57 |
}
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
def optimize_dishes_for_budget(city, daily_budget):
|
| 60 |
# Extracting cost, calories, and protein data for the selected city
|
| 61 |
costs = [nutritional_data[dish][city] for dish in nutritional_data]
|
|
|
|
| 87 |
for dish, qty in zip(selected_dishes, quantities):
|
| 88 |
if qty > 1e-5:
|
| 89 |
result_str += f"- **{qty:.2f} portions of {dish}** at ₹{nutritional_data[dish][city]} per portion\n"
|
|
|
|
| 90 |
# Add detailed information about each selected dish
|
| 91 |
result_str += f" - Total Cost: ₹{nutritional_data[dish][city] * qty:.2f}\n"
|
| 92 |
result_str += f" - Total Energy: {nutritional_data[dish]['Energy (kcal)'] * qty:.2f} kcal\n"
|
| 93 |
+
result_str += f" - Total Protein: {nutritional_data[dish]['Protein (g)'] * qty:.2f} g\n\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
result_str += f"\n### Total Cost: ₹{total_cost:.2f}\n"
|
| 96 |
result_str += f"### Total Calories: {total_calories:.2f} kcal\n"
|