geethareddy's picture
Update components/menu.py
b86b48e verified
raw
history blame contribute delete
898 Bytes
from components.popup_card import show_popup_card
import gradio as gr
menu_items = [
{"name": "Veg Majestic", "price": 13, "image": "static/images/food_items/veg_majestic.png", "portion": "Medium"},
{"name": "Murgh (Chicken)", "price": 14, "image": "static/images/food_items/murgh.png", "portion": "Large"},
{"name": "Dal Fry", "price": 11, "image": "static/images/food_items/dal_fry.png", "portion": "Small"},
]
def render_menu(app):
with app:
for item in menu_items:
with gr.Row():
gr.Image(item["image"], elem_id=f"{item['name']}_img")
gr.Markdown(f"**{item['name']}** - ₹{item['price']}")
gr.Button("ADD", elem_id=f"{item['name']}_add").click(
show_popup_card,
inputs=[item["name"], item["image"], item["portion"]],
outputs=[]
)