Spaces:
Sleeping
Sleeping
Update components/menu.py
Browse files- 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 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
{"name": "Chicken Wings", "image": "static/images/chicken_wings.png", "model": "static/3d_models/chicken_wings.glb"},
|
10 |
-
]
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
with gr.Row() as menu_row:
|
16 |
for item in menu_items:
|
17 |
-
with gr.
|
18 |
-
gr.Image(item["image"],
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
inputs=[
|
23 |
-
|
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 |
)
|
|
|
|