Leospencer1 commited on
Commit
a1b5d12
Β·
verified Β·
1 Parent(s): 609e38e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +87 -87
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
- 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):
 
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):