Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1266,93 +1266,93 @@ with gr.Blocks(title="Bitesized AI Meal Planner") as demo:
|
|
| 1266 |
with gr.Row():
|
| 1267 |
people_count = gr.Slider(
|
| 1268 |
label="π₯ How many people do you cook for?",
|
| 1269 |
-
|
| 1270 |
-
|
| 1271 |
-
|
| 1272 |
-
|
| 1273 |
-
|
| 1274 |
-
|
| 1275 |
-
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
-
|
| 1287 |
-
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
-
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
|
| 1302 |
-
|
| 1303 |
-
|
| 1304 |
-
|
| 1305 |
-
|
| 1306 |
-
|
| 1307 |
-
|
| 1308 |
-
|
| 1309 |
-
|
| 1310 |
-
|
| 1311 |
-
|
| 1312 |
-
|
| 1313 |
-
|
| 1314 |
-
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
-
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
|
| 1333 |
-
|
| 1334 |
-
|
| 1335 |
-
|
| 1336 |
-
|
| 1337 |
-
|
| 1338 |
-
|
| 1339 |
-
|
| 1340 |
-
|
| 1341 |
-
|
| 1342 |
-
|
| 1343 |
-
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
| 1354 |
-
|
| 1355 |
-
|
| 1356 |
|
| 1357 |
# Function to calculate and show savings in real-time
|
| 1358 |
def show_savings_preview(current_spending, people, meals):
|
|
|
|
| 1266 |
with gr.Row():
|
| 1267 |
people_count = gr.Slider(
|
| 1268 |
label="π₯ How many people do you cook for?",
|
| 1269 |
+
minimum=1,
|
| 1270 |
+
maximum=10,
|
| 1271 |
+
value=4,
|
| 1272 |
+
step=1,
|
| 1273 |
+
info="Number of people you're feeding"
|
| 1274 |
+
)
|
| 1275 |
+
meals_per_week = gr.Slider(
|
| 1276 |
+
label="π½οΈ How many meals do you cook per week?",
|
| 1277 |
+
minimum=1,
|
| 1278 |
+
maximum=14,
|
| 1279 |
+
value=7,
|
| 1280 |
+
step=1,
|
| 1281 |
+
info="E.g., 7 = one dinner every night"
|
| 1282 |
+
)
|
| 1283 |
+
|
| 1284 |
+
# Savings display (appears after user enters info)
|
| 1285 |
+
savings_display = gr.Markdown(visible=False)
|
| 1286 |
+
|
| 1287 |
+
# Step 3: Preferences
|
| 1288 |
+
gr.Markdown("### Step 3: Preferences")
|
| 1289 |
+
with gr.Row():
|
| 1290 |
+
postcode = gr.Textbox(
|
| 1291 |
+
label="π Postcode (optional)",
|
| 1292 |
+
placeholder="e.g., LE1 7RH",
|
| 1293 |
+
info="For local supermarket recommendations",
|
| 1294 |
+
scale=1
|
| 1295 |
+
)
|
| 1296 |
+
preferences = gr.Textbox(
|
| 1297 |
+
label="π₯ Dietary Needs (optional)",
|
| 1298 |
+
placeholder="e.g., vegetarian, gluten-free",
|
| 1299 |
+
info="Any dietary requirements",
|
| 1300 |
+
scale=1
|
| 1301 |
+
)
|
| 1302 |
+
|
| 1303 |
+
with gr.Row():
|
| 1304 |
+
meal_type = gr.Dropdown(
|
| 1305 |
+
label="Meal Type",
|
| 1306 |
+
choices=["Breakfast", "Lunch", "Dinner", "Dessert", "Snack"],
|
| 1307 |
+
value="Dinner",
|
| 1308 |
+
info="What type of meal?",
|
| 1309 |
+
scale=1
|
| 1310 |
+
)
|
| 1311 |
+
budget_preference = gr.Dropdown(
|
| 1312 |
+
label="Budget Style",
|
| 1313 |
+
choices=["Spend Full Budget", "Spend Under Budget"],
|
| 1314 |
+
value="Spend Full Budget",
|
| 1315 |
+
info="Use full budget for better meals, or save extra money",
|
| 1316 |
+
scale=1
|
| 1317 |
+
)
|
| 1318 |
+
|
| 1319 |
+
# Generate button
|
| 1320 |
+
gr.Markdown("### Step 4: Generate Your Recipes!")
|
| 1321 |
+
generate_btn = gr.Button("β¨ Generate My Recipes", variant="primary", size="lg")
|
| 1322 |
+
|
| 1323 |
+
# Results - Add all necessary components for recipe display
|
| 1324 |
+
gr.Markdown("---")
|
| 1325 |
+
info_output = gr.Markdown()
|
| 1326 |
+
|
| 1327 |
+
with gr.Row():
|
| 1328 |
+
# Left: Recipe list
|
| 1329 |
+
with gr.Column(scale=1):
|
| 1330 |
+
title_radio = gr.Radio(label="π Your Recipes", choices=[])
|
| 1331 |
+
|
| 1332 |
+
# Refresh options in accordion
|
| 1333 |
+
with gr.Accordion("π Fancy something different?", open=False):
|
| 1334 |
+
keep_checkboxes = gr.CheckboxGroup(label="Keep these recipes", choices=[], visible=False)
|
| 1335 |
+
refresh_unwanted_btn = gr.Button("Refresh Unselected", size="sm", visible=False)
|
| 1336 |
+
regenerate_btn = gr.Button("π Generate Completely New Set", size="sm", visible=False)
|
| 1337 |
+
|
| 1338 |
+
# Right: Recipe details
|
| 1339 |
+
with gr.Column(scale=2):
|
| 1340 |
+
recipe_markdown = gr.HTML("")
|
| 1341 |
+
|
| 1342 |
+
# Confirm button for adding to shopping list
|
| 1343 |
+
confirm_all_btn = gr.Button("β
Confirm My Meals & Add All Ingredients to Shopping List",
|
| 1344 |
+
visible=False,
|
| 1345 |
+
variant="primary",
|
| 1346 |
+
size="lg")
|
| 1347 |
+
|
| 1348 |
+
# Status message for saves
|
| 1349 |
+
save_status = gr.Markdown("", visible=True)
|
| 1350 |
+
|
| 1351 |
+
# Add hidden components
|
| 1352 |
+
ingredient_info = gr.Markdown("", visible=False)
|
| 1353 |
+
|
| 1354 |
+
# Hidden fields for cost calculation
|
| 1355 |
+
cost_per_meal = gr.Textbox(visible=False, value="3.50")
|
| 1356 |
|
| 1357 |
# Function to calculate and show savings in real-time
|
| 1358 |
def show_savings_preview(current_spending, people, meals):
|