Spaces:
Sleeping
Sleeping
import gradio as gr | |
from components.cart import add_to_cart | |
def show_popup(dish_name, menu_data): | |
"""Displays the popup for the selected menu item.""" | |
dish = menu_data[menu_data['Dish Name'] == dish_name].iloc[0] | |
popup = gr.Column([ | |
gr.Markdown(f"### {dish_name} - ${dish['Price']}"), | |
gr.Image(f"static/images/{dish['Image']}"), | |
gr.Markdown(f"{dish['Description']}"), | |
# Spice Level | |
gr.Radio( | |
label="Choose a spice level (Required)", | |
choices=["American Mild", "American Medium", "American Spicy", | |
"Indian Mild", "Indian Medium", "Indian Very Spicy"], | |
value="Indian Medium" | |
), | |
# Extras | |
gr.CheckboxGroup( | |
label="Biryani Extras (Optional)", | |
choices=["Extra Raita 4oz + $1.00", "Extra Raita 8oz + $2.00", | |
"Extra Salan 8oz + $2.00", "Extra Onion + $1.00", | |
"Extra Onion & Lemon + $2.00", "Extra Fried Onion 4oz + $2.00"] | |
), | |
# Special Instructions | |
gr.Textbox( | |
label="Special Instructions", | |
placeholder="Add any requests here." | |
), | |
# Quantity | |
gr.Slider( | |
label="Quantity", | |
minimum=1, | |
maximum=10, | |
step=1, | |
value=1 | |
), | |
# Add to Cart Button | |
gr.Button("Add to Bag").click( | |
add_to_cart, | |
inputs=[dish_name, gr.Radio, gr.CheckboxGroup, gr.Textbox, gr.Slider], | |
outputs="cart_display" | |
) | |
]) | |
return popup | |