geethareddy commited on
Commit
b86b48e
·
verified ·
1 Parent(s): 225b521

Update components/menu.py

Browse files
Files changed (1) hide show
  1. components/menu.py +15 -24
components/menu.py CHANGED
@@ -1,29 +1,20 @@
 
1
  import gradio as gr
2
- from components.popup_card import generate_popup_card
3
 
4
- def generate_menu():
5
- menu_items = [
6
- {"name": "Biryani", "image": "static/images/biryani.png", "model": "static/3d_models/biryani.glb"},
7
- {"name": "Noodles", "image": "static/images/noodles.png", "model": "static/3d_models/noodles.glb"},
8
- {"name": "Fried Rice", "image": "static/images/fried_rice.png", "model": "static/3d_models/fried_rice.glb"},
9
- {"name": "Chicken Wings", "image": "static/images/chicken_wings.png", "model": "static/3d_models/chicken_wings.glb"},
10
- ]
11
 
12
- def show_popup(item_name, model_path):
13
- return generate_popup_card(item_name, model_path)
14
-
15
- with gr.Row() as menu_row:
16
  for item in menu_items:
17
- with gr.Column():
18
- gr.Image(item["image"], label=item["name"])
19
- button = gr.Button(f"Add {item['name']}")
20
- button.click(
21
- show_popup,
22
- inputs=[
23
- gr.Textbox(value=item["name"], visible=False), # Item Name
24
- gr.Textbox(value=item["model"], visible=False), # Model Path
25
- ],
26
- outputs=gr.HTML() # Popup will render as HTML
27
  )
28
-
29
- return menu_row
 
1
+ from components.popup_card import show_popup_card
2
  import gradio as gr
 
3
 
4
+ menu_items = [
5
+ {"name": "Veg Majestic", "price": 13, "image": "static/images/food_items/veg_majestic.png", "portion": "Medium"},
6
+ {"name": "Murgh (Chicken)", "price": 14, "image": "static/images/food_items/murgh.png", "portion": "Large"},
7
+ {"name": "Dal Fry", "price": 11, "image": "static/images/food_items/dal_fry.png", "portion": "Small"},
8
+ ]
 
 
9
 
10
+ def render_menu(app):
11
+ with app:
 
 
12
  for item in menu_items:
13
+ with gr.Row():
14
+ gr.Image(item["image"], elem_id=f"{item['name']}_img")
15
+ gr.Markdown(f"**{item['name']}** - ₹{item['price']}")
16
+ gr.Button("ADD", elem_id=f"{item['name']}_add").click(
17
+ show_popup_card,
18
+ inputs=[item["name"], item["image"], item["portion"]],
19
+ outputs=[]
 
 
 
20
  )