Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,8 +24,8 @@ menu_data = [
|
|
| 24 |
"spice_level": "Mild", "portion_size": "Small"}
|
| 25 |
]
|
| 26 |
|
| 27 |
-
spice_options = ["Mild", "Medium", "High"]
|
| 28 |
-
portion_options = ["Small", "Medium", "Large"]
|
| 29 |
|
| 30 |
# Function to filter dishes based on category
|
| 31 |
def filter_dishes(category):
|
|
@@ -40,11 +40,11 @@ def display_dishes(category):
|
|
| 40 |
for dish in filtered_dishes:
|
| 41 |
html_content += f"""
|
| 42 |
<div style='margin: 10px; text-align: center; cursor: pointer; border: 1px solid #ddd;
|
| 43 |
-
padding: 10px; border-radius: 10px; width: 200px;'
|
| 44 |
onclick='selectDish("{dish['name']}")'>
|
| 45 |
<img src='{dish['image']}' alt='{dish['name']}'
|
| 46 |
style='width: 180px; height: 120px; object-fit: cover; border-radius: 10px;'>
|
| 47 |
-
<h4 style='margin-top: 10px; font-size: 16px;'>{dish['name']}</h4>
|
| 48 |
</div>
|
| 49 |
"""
|
| 50 |
html_content += "</div>"
|
|
@@ -54,16 +54,16 @@ def display_dishes(category):
|
|
| 54 |
def get_dish_details(dish_name):
|
| 55 |
for dish in menu_data:
|
| 56 |
if dish["name"] == dish_name:
|
| 57 |
-
return (dish["image"], dish["name"], dish["description"],
|
| 58 |
return ("https://via.placeholder.com/300x200", "Unknown Dish", "No description available.", "N/A", "N/A")
|
| 59 |
|
| 60 |
# Function to simulate placing an order
|
| 61 |
def place_order(dish_name, spice_level, portion_size):
|
| 62 |
-
return f"
|
| 63 |
|
| 64 |
# Main Gradio App
|
| 65 |
with gr.Blocks() as demo:
|
| 66 |
-
gr.HTML("<h1 style='text-align: center;'
|
| 67 |
|
| 68 |
# Buttons for category selection
|
| 69 |
gr.Markdown("### Select a Category")
|
|
@@ -83,8 +83,8 @@ with gr.Blocks() as demo:
|
|
| 83 |
with gr.Column():
|
| 84 |
dish_name = gr.Textbox(label="Dish Name", interactive=False)
|
| 85 |
dish_description = gr.Textbox(label="Description", interactive=False)
|
| 86 |
-
spice_dropdown = gr.
|
| 87 |
-
portion_dropdown = gr.
|
| 88 |
|
| 89 |
# Place Order Button
|
| 90 |
place_order_btn = gr.Button("Place Order")
|
|
@@ -123,5 +123,4 @@ with gr.Blocks() as demo:
|
|
| 123 |
</script>
|
| 124 |
""")
|
| 125 |
|
| 126 |
-
# Launch the app
|
| 127 |
demo.launch()
|
|
|
|
| 24 |
"spice_level": "Mild", "portion_size": "Small"}
|
| 25 |
]
|
| 26 |
|
| 27 |
+
spice_options = ["πΆ Mild", "πΆπΆ Medium", "πΆπΆπΆ High"]
|
| 28 |
+
portion_options = ["π§ Small", "π½ Medium", "π Large"]
|
| 29 |
|
| 30 |
# Function to filter dishes based on category
|
| 31 |
def filter_dishes(category):
|
|
|
|
| 40 |
for dish in filtered_dishes:
|
| 41 |
html_content += f"""
|
| 42 |
<div style='margin: 10px; text-align: center; cursor: pointer; border: 1px solid #ddd;
|
| 43 |
+
padding: 10px; border-radius: 10px; width: 200px; background-color: #f9f9f9;'
|
| 44 |
onclick='selectDish("{dish['name']}")'>
|
| 45 |
<img src='{dish['image']}' alt='{dish['name']}'
|
| 46 |
style='width: 180px; height: 120px; object-fit: cover; border-radius: 10px;'>
|
| 47 |
+
<h4 style='margin-top: 10px; font-size: 16px; color: #444;'>{dish['name']}</h4>
|
| 48 |
</div>
|
| 49 |
"""
|
| 50 |
html_content += "</div>"
|
|
|
|
| 54 |
def get_dish_details(dish_name):
|
| 55 |
for dish in menu_data:
|
| 56 |
if dish["name"] == dish_name:
|
| 57 |
+
return (dish["image"], dish["name"], dish["description"], "πΆ Medium", "π½ Regular")
|
| 58 |
return ("https://via.placeholder.com/300x200", "Unknown Dish", "No description available.", "N/A", "N/A")
|
| 59 |
|
| 60 |
# Function to simulate placing an order
|
| 61 |
def place_order(dish_name, spice_level, portion_size):
|
| 62 |
+
return f"β
Order Confirmed: '{dish_name}' with {spice_level} spice level and {portion_size} portion size."
|
| 63 |
|
| 64 |
# Main Gradio App
|
| 65 |
with gr.Blocks() as demo:
|
| 66 |
+
gr.HTML("<h1 style='text-align: center; color: #333;'>π Biryani Hub Menu π</h1>")
|
| 67 |
|
| 68 |
# Buttons for category selection
|
| 69 |
gr.Markdown("### Select a Category")
|
|
|
|
| 83 |
with gr.Column():
|
| 84 |
dish_name = gr.Textbox(label="Dish Name", interactive=False)
|
| 85 |
dish_description = gr.Textbox(label="Description", interactive=False)
|
| 86 |
+
spice_dropdown = gr.Radio(label="Select Spice Level", choices=spice_options, value="πΆ Medium")
|
| 87 |
+
portion_dropdown = gr.Radio(label="Select Portion Size", choices=portion_options, value="π½ Medium")
|
| 88 |
|
| 89 |
# Place Order Button
|
| 90 |
place_order_btn = gr.Button("Place Order")
|
|
|
|
| 123 |
</script>
|
| 124 |
""")
|
| 125 |
|
|
|
|
| 126 |
demo.launch()
|