SathvikGanta commited on
Commit
3d58636
Β·
verified Β·
1 Parent(s): 7d78f91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -15
app.py CHANGED
@@ -15,25 +15,27 @@ with gr.Blocks(css="styles.css") as app:
15
  gr.Markdown(
16
  """
17
  ### Explore Popular Dishes πŸ›
18
- Click on any dish card below to view its image, nutritional facts, and portion size.
19
  """
20
  )
21
 
22
- # Display all items as clickable cards
23
- with gr.Row(elem_id="food-list"):
24
- display_area = gr.HTML() # Popup card display area
25
  for food_name in FOOD_DATA.keys():
26
- with gr.Column():
27
- # Each button is a card for a food item
28
- gr.Button(
29
- value=food_name,
30
- elem_id=f"food-{food_name.replace(' ', '-').lower()}",
31
- interactive=True,
32
- ).click(
33
- display_card,
34
- inputs=[gr.Textbox(value=food_name, visible=False)],
35
- outputs=display_area
36
- )
 
 
37
 
38
  # Launch the app
39
  app.launch()
 
15
  gr.Markdown(
16
  """
17
  ### Explore Popular Dishes πŸ›
18
+ Click on any dish below to view its image, nutritional facts, and portion size.
19
  """
20
  )
21
 
22
+ # Display all items as a vertical list
23
+ with gr.Column(elem_id="food-list"):
24
+ display_area = gr.HTML(visible=False) # Popup card display area
25
  for food_name in FOOD_DATA.keys():
26
+ gr.Button(
27
+ value=food_name,
28
+ elem_id=f"food-{food_name.replace(' ', '-').lower()}",
29
+ interactive=True,
30
+ ).click(
31
+ display_card,
32
+ inputs=[gr.Textbox(value=food_name, visible=False)],
33
+ outputs=display_area
34
+ )
35
+
36
+ # Add a dedicated display area for the popup
37
+ with gr.Row(elem_id="popup-container"):
38
+ display_area.render()
39
 
40
  # Launch the app
41
  app.launch()