fionasu commited on
Commit
7afc614
Β·
verified Β·
1 Parent(s): b9b0f92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +62 -20
app.py CHANGED
@@ -228,6 +228,15 @@ def reset_inputs():
228
  [] # activity
229
  )
230
 
 
 
 
 
 
 
 
 
 
231
  with gr.Blocks(theme=theme) as demo:
232
  with gr.Row():
233
  # ─── left column: your controls ───
@@ -257,27 +266,60 @@ with gr.Blocks(theme=theme) as demo:
257
  label="Season:"
258
  )
259
 
260
- gr.Markdown("### Luggage")
261
- luggage_types = gr.CheckboxGroup(
262
- choices=["Carry-on","Checked"],
263
- label="What is your luggage type?"
264
- )
265
- luggage_size = gr.Slider(
266
- minimum=10, maximum=100, step=10, value=20,
267
- label="What is the size of you luggage (liters)?"
268
- )
269
- gr.Markdown("### Food")
270
- food_prefs = gr.Dropdown(
271
- choices=["Italian", "Thai", "Mexican", "Japanese", "Seafood", "Asian Fusion", "Korean", "Brunch", "Bakery", "Vegan", "Chinese", "Coffee", "Boba", "Fast-Food", "Dessert", "Greek", "Indian"],
272
- label="What are your food preferences?",
273
- multiselect=True
274
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
 
276
- gr.Markdown("### Activity Interests")
277
- activity = gr.Dropdown(
278
- choices=["Outdoor & Nature", "Indoor", "Sight-Seeing & Landmarks", "Culture, History & Museums", "Arts & Entertainment", "Active & Adventure", "Relaxation", "Shopping & Lifestyle", "Family-Friendly"],
279
- label="What are your actvity preferences?",
280
- multiselect=True
281
  )
282
 
283
  reset_btn = gr.Button("Reset All", variant="secondary")
 
228
  [] # activity
229
  )
230
 
231
+ def update_visibility(chatbot_mode):
232
+ if chatbot_mode == "Packing":
233
+ return gr.update(visible=True), gr.update(visible=False)
234
+ elif chatbot_mode == "Food/Attractions":
235
+ return gr.update(visible=False), gr.update(visible=True)
236
+ else:
237
+ return gr.update(visible=True), gr.update(visible=True)
238
+
239
+
240
  with gr.Blocks(theme=theme) as demo:
241
  with gr.Row():
242
  # ─── left column: your controls ───
 
266
  label="Season:"
267
  )
268
 
269
+ # gr.Markdown("### Luggage")
270
+ # luggage_types = gr.CheckboxGroup(
271
+ # choices=["Carry-on","Checked"],
272
+ # label="What is your luggage type?"
273
+ # )
274
+ # luggage_size = gr.Slider(
275
+ # minimum=10, maximum=100, step=10, value=20,
276
+ # label="What is the size of you luggage (liters)?"
277
+
278
+ with gr.Group(visible=True) as packing_group:
279
+ gr.Markdown("### Luggage")
280
+ luggage_types = gr.CheckboxGroup(
281
+ choices=["Carry-on", "Checked"],
282
+ label="What is your luggage type?"
283
+ )
284
+ luggage_size = gr.Slider(
285
+ minimum=10, maximum=100, step=10, value=20,
286
+ label="What is the size of your luggage (liters)?"
287
+ )
288
+
289
+ # )
290
+ # gr.Markdown("### Food")
291
+ # food_prefs = gr.Dropdown(
292
+ # choices=["Italian", "Thai", "Mexican", "Japanese", "Seafood", "Asian Fusion", "Korean", "Brunch", "Bakery", "Vegan", "Chinese", "Coffee", "Boba", "Fast-Food", "Dessert", "Greek", "Indian"],
293
+ # label="What are your food preferences?",
294
+ # multiselect=True
295
+ # )
296
+
297
+ # gr.Markdown("### Activity Interests")
298
+ # activity = gr.Dropdown(
299
+ # choices=["Outdoor & Nature", "Indoor", "Sight-Seeing & Landmarks", "Culture, History & Museums", "Arts & Entertainment", "Active & Adventure", "Relaxation", "Shopping & Lifestyle", "Family-Friendly"],
300
+ # label="What are your actvity preferences?",
301
+ # multiselect=True
302
+ # )
303
+
304
+ with gr.Group(visible=True) as food_group:
305
+ gr.Markdown("### Food")
306
+ food_prefs = gr.Dropdown(
307
+ choices=["Italian", "Thai", "Mexican", "Japanese", "Vegan", "Seafood"],
308
+ multiselect=True,
309
+ label="What are your food preferences?"
310
+ )
311
+
312
+ gr.Markdown("### Activities")
313
+ activity = gr.Dropdown(
314
+ choices=["Outdoor & Nature", "Indoor", "Museums", "Shopping", "Relaxation"],
315
+ multiselect=True,
316
+ label="What are your activity preferences?"
317
+ )
318
 
319
+ chatbot_mode.change(
320
+ fn=update_visibility,
321
+ inputs=[chatbot_mode],
322
+ outputs=[packing_group, food_group]
 
323
  )
324
 
325
  reset_btn = gr.Button("Reset All", variant="secondary")