Spaces:
Sleeping
Sleeping
Update components/menu.py
Browse files- components/menu.py +9 -4
components/menu.py
CHANGED
@@ -9,16 +9,21 @@ def generate_menu():
|
|
9 |
{"name": "Chicken Wings", "image": "static/images/chicken_wings.png", "model": "static/3d_models/chicken_wings.glb"},
|
10 |
]
|
11 |
|
|
|
|
|
|
|
12 |
with gr.Row() as menu_row:
|
13 |
for item in menu_items:
|
14 |
with gr.Column():
|
15 |
gr.Image(item["image"], label=item["name"])
|
16 |
button = gr.Button(f"Add {item['name']}")
|
17 |
-
# Connect button to generate_popup_card function
|
18 |
button.click(
|
19 |
-
|
20 |
-
inputs=[
|
21 |
-
|
|
|
|
|
|
|
22 |
)
|
23 |
|
24 |
return menu_row
|
|
|
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
|