geethareddy's picture
Create components/menu.py
65e275b verified
raw
history blame
990 Bytes
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"])
gr.Button("Add", elem_id=f"add-{item['name']}").click(
generate_popup_card,
inputs=[item["name"], item["model"]],
outputs="popup-container"
)
return menu_row