Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,15 +5,15 @@ menu_data = [
|
|
| 5 |
{"name": "Veg Burger", "category": "VEGAN",
|
| 6 |
"image": "https://upload.wikimedia.org/wikipedia/commons/6/6e/Veggie_burger.jpg",
|
| 7 |
"description": "A delicious vegan burger with plant-based patty, lettuce, and tomato.",
|
| 8 |
-
"spice_level": "
|
| 9 |
{"name": "Chicken Biryani", "category": "HALAL",
|
| 10 |
"image": "https://upload.wikimedia.org/wikipedia/commons/7/79/Chicken_Biryani.jpg",
|
| 11 |
"description": "Spicy chicken biryani with aromatic basmati rice and tender chicken pieces.",
|
| 12 |
-
"spice_level": "
|
| 13 |
{"name": "Paneer Butter Masala", "category": "VEGAN",
|
| 14 |
"image": "https://upload.wikimedia.org/wikipedia/commons/3/3d/Paneer_Butter_Masala.jpg",
|
| 15 |
"description": "Paneer cooked in a rich and creamy tomato-based gravy.",
|
| 16 |
-
"spice_level": "
|
| 17 |
]
|
| 18 |
|
| 19 |
spice_options = ["πΆ Mild", "πΆπΆ Medium", "πΆπΆπΆ High"]
|
|
@@ -38,8 +38,8 @@ def display_dishes(category):
|
|
| 38 |
def get_dish_details(dish_name):
|
| 39 |
for dish in menu_data:
|
| 40 |
if dish["name"] == dish_name:
|
| 41 |
-
return dish["image"], dish["name"], dish["description"], "
|
| 42 |
-
return "https://via.placeholder.com/300x200", "Unknown Dish", "No description available.", "
|
| 43 |
|
| 44 |
def place_order(dish_name, spice_level, portion_size):
|
| 45 |
return f"β
Order Confirmed: '{dish_name}' with {spice_level} spice level and {portion_size} portion size."
|
|
@@ -75,8 +75,8 @@ with gr.Blocks() as demo:
|
|
| 75 |
with gr.Column():
|
| 76 |
dish_name = gr.Textbox(label="Dish Name", interactive=False)
|
| 77 |
dish_description = gr.Textbox(label="Description", interactive=False)
|
| 78 |
-
spice_dropdown = gr.Radio(label="Select Spice Level", choices=spice_options, value="πΆ
|
| 79 |
-
portion_dropdown = gr.Radio(label="Select Portion Size", choices=portion_options, value="
|
| 80 |
close_popup = gr.Button("Close")
|
| 81 |
|
| 82 |
place_order_btn = gr.Button("Place Order")
|
|
@@ -93,7 +93,7 @@ with gr.Blocks() as demo:
|
|
| 93 |
selected_dish_name.change(
|
| 94 |
fn=lambda dish_name: (*get_dish_details(dish_name), gr.update(visible=True)),
|
| 95 |
inputs=selected_dish_name,
|
| 96 |
-
outputs=[dish_image, dish_name, dish_description, popup],
|
| 97 |
)
|
| 98 |
|
| 99 |
close_popup.click(fn=lambda: gr.update(visible=False), outputs=popup)
|
|
|
|
| 5 |
{"name": "Veg Burger", "category": "VEGAN",
|
| 6 |
"image": "https://upload.wikimedia.org/wikipedia/commons/6/6e/Veggie_burger.jpg",
|
| 7 |
"description": "A delicious vegan burger with plant-based patty, lettuce, and tomato.",
|
| 8 |
+
"spice_level": "πΆ Mild", "portion_size": "π§ Small"},
|
| 9 |
{"name": "Chicken Biryani", "category": "HALAL",
|
| 10 |
"image": "https://upload.wikimedia.org/wikipedia/commons/7/79/Chicken_Biryani.jpg",
|
| 11 |
"description": "Spicy chicken biryani with aromatic basmati rice and tender chicken pieces.",
|
| 12 |
+
"spice_level": "πΆπΆ Medium", "portion_size": "π Large"},
|
| 13 |
{"name": "Paneer Butter Masala", "category": "VEGAN",
|
| 14 |
"image": "https://upload.wikimedia.org/wikipedia/commons/3/3d/Paneer_Butter_Masala.jpg",
|
| 15 |
"description": "Paneer cooked in a rich and creamy tomato-based gravy.",
|
| 16 |
+
"spice_level": "πΆπΆπΆ High", "portion_size": "π½ Medium"},
|
| 17 |
]
|
| 18 |
|
| 19 |
spice_options = ["πΆ Mild", "πΆπΆ Medium", "πΆπΆπΆ High"]
|
|
|
|
| 38 |
def get_dish_details(dish_name):
|
| 39 |
for dish in menu_data:
|
| 40 |
if dish["name"] == dish_name:
|
| 41 |
+
return dish["image"], dish["name"], dish["description"], dish["spice_level"], dish["portion_size"]
|
| 42 |
+
return "https://via.placeholder.com/300x200", "Unknown Dish", "No description available.", "πΆ Mild", "π§ Small"
|
| 43 |
|
| 44 |
def place_order(dish_name, spice_level, portion_size):
|
| 45 |
return f"β
Order Confirmed: '{dish_name}' with {spice_level} spice level and {portion_size} portion size."
|
|
|
|
| 75 |
with gr.Column():
|
| 76 |
dish_name = gr.Textbox(label="Dish Name", interactive=False)
|
| 77 |
dish_description = gr.Textbox(label="Description", interactive=False)
|
| 78 |
+
spice_dropdown = gr.Radio(label="Select Spice Level", choices=spice_options, value="πΆ Mild")
|
| 79 |
+
portion_dropdown = gr.Radio(label="Select Portion Size", choices=portion_options, value="π§ Small")
|
| 80 |
close_popup = gr.Button("Close")
|
| 81 |
|
| 82 |
place_order_btn = gr.Button("Place Order")
|
|
|
|
| 93 |
selected_dish_name.change(
|
| 94 |
fn=lambda dish_name: (*get_dish_details(dish_name), gr.update(visible=True)),
|
| 95 |
inputs=selected_dish_name,
|
| 96 |
+
outputs=[dish_image, dish_name, dish_description, spice_dropdown, portion_dropdown, popup],
|
| 97 |
)
|
| 98 |
|
| 99 |
close_popup.click(fn=lambda: gr.update(visible=False), outputs=popup)
|