Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,23 +13,29 @@ def get_food_details(name, image, nutrition):
|
|
13 |
"""
|
14 |
|
15 |
# Gradio Interface
|
16 |
-
with gr.Blocks(
|
17 |
gr.Markdown("<h1 style='text-align:center;'>🍽️ Restaurant Menu 🍽️</h1>")
|
18 |
gr.Markdown("<p style='text-align:center;'>Explore our Vegetarian and Non-Vegetarian Dishes</p>")
|
19 |
|
20 |
for category, items in FOOD_ITEMS.items():
|
21 |
gr.Markdown(f"<h2 style='color:#FF6347;'>{category} Menu</h2>")
|
22 |
-
|
23 |
with gr.Row():
|
24 |
-
for item in items:
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
gr.Markdown("<p style='text-align:center; margin-top:20px;'>© 2024 Delicious Restaurant | Built with ❤️</p>")
|
34 |
|
35 |
demo.launch()
|
|
|
13 |
"""
|
14 |
|
15 |
# Gradio Interface
|
16 |
+
with gr.Blocks(css="templates/style.css") as demo:
|
17 |
gr.Markdown("<h1 style='text-align:center;'>🍽️ Restaurant Menu 🍽️</h1>")
|
18 |
gr.Markdown("<p style='text-align:center;'>Explore our Vegetarian and Non-Vegetarian Dishes</p>")
|
19 |
|
20 |
for category, items in FOOD_ITEMS.items():
|
21 |
gr.Markdown(f"<h2 style='color:#FF6347;'>{category} Menu</h2>")
|
|
|
22 |
with gr.Row():
|
23 |
+
for idx, item in enumerate(items):
|
24 |
+
# Each block must have a unique variable or unique creation
|
25 |
+
with gr.Column():
|
26 |
+
btn = gr.Button(f"{item['name']}", elem_id=f"menu-item-{idx}")
|
27 |
+
output = gr.HTML()
|
28 |
+
|
29 |
+
btn.click(
|
30 |
+
fn=get_food_details,
|
31 |
+
inputs=[
|
32 |
+
gr.Text(item['name']),
|
33 |
+
gr.Text(item['image']),
|
34 |
+
gr.Text(item['nutrition'])
|
35 |
+
],
|
36 |
+
outputs=output
|
37 |
+
)
|
38 |
+
|
39 |
gr.Markdown("<p style='text-align:center; margin-top:20px;'>© 2024 Delicious Restaurant | Built with ❤️</p>")
|
40 |
|
41 |
demo.launch()
|