Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from components.popup_card import generate_popup_card | |
| def generate_menu(): | |
| menu_items = [ | |
| {"name": "Biryani", "image": "static/images/biryani.png", "model": "static/3d_models/biryani.glb"}, | |
| {"name": "Noodles", "image": "static/images/noodles.png", "model": "static/3d_models/noodles.glb"}, | |
| {"name": "Fried Rice", "image": "static/images/fried_rice.png", "model": "static/3d_models/fried_rice.glb"}, | |
| {"name": "Chicken Wings", "image": "static/images/chicken_wings.png", "model": "static/3d_models/chicken_wings.glb"}, | |
| ] | |
| with gr.Row() as menu_row: | |
| for item in menu_items: | |
| with gr.Column(): | |
| gr.Image(item["image"], label=item["name"]) | |
| button = gr.Button(f"Add {item['name']}") | |
| # Connect button to generate_popup_card function | |
| button.click( | |
| fn=generate_popup_card, | |
| inputs=[gr.Textbox(value=item["name"], visible=False), gr.Textbox(value=item["model"], visible=False)], | |
| outputs=gr.update(visible=True) # Show the popup | |
| ) | |
| return menu_row | |