Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
|
4 |
-
#
|
5 |
def load_menu():
|
6 |
try:
|
7 |
return pd.read_excel("menu.xlsx") # Ensure menu.xlsx exists in the same directory
|
@@ -24,11 +24,11 @@ def filter_menu(preference):
|
|
24 |
html_content = ""
|
25 |
for _, item in filtered_data.iterrows():
|
26 |
html_content += f"""
|
27 |
-
<div class="menu-
|
28 |
-
<img src="{item['Image URL']}" alt="{item['Dish Name']}" class="
|
29 |
-
<h3>{item['Dish Name']}</h3>
|
30 |
-
<p>{item['Description']}</p>
|
31 |
-
<p><strong>${item['Price ($)']}</strong></p>
|
32 |
<button onclick="showModal('{item['Dish Name']}')" class="add-button">Add</button>
|
33 |
</div>
|
34 |
"""
|
@@ -52,9 +52,9 @@ def get_dish_details(dish_name):
|
|
52 |
# Main Gradio app
|
53 |
def app():
|
54 |
with gr.Blocks(css="style.css") as demo:
|
55 |
-
gr.Markdown("## Dynamic Menu with Modal
|
56 |
|
57 |
-
#
|
58 |
preference_selector = gr.Radio(
|
59 |
choices=["All", "Vegetarian", "Halal/Non-Veg", "Guilt-Free"],
|
60 |
value="All",
|
@@ -62,7 +62,7 @@ def app():
|
|
62 |
)
|
63 |
menu_output = gr.HTML(value=filter_menu("All"))
|
64 |
|
65 |
-
# Modal
|
66 |
modal = gr.Column(visible=False, elem_classes=["popup"])
|
67 |
modal_image = gr.Image(label="Dish Image")
|
68 |
modal_name = gr.Markdown()
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
|
4 |
+
# Load menu data from Excel
|
5 |
def load_menu():
|
6 |
try:
|
7 |
return pd.read_excel("menu.xlsx") # Ensure menu.xlsx exists in the same directory
|
|
|
24 |
html_content = ""
|
25 |
for _, item in filtered_data.iterrows():
|
26 |
html_content += f"""
|
27 |
+
<div class="menu-card">
|
28 |
+
<img src="{item['Image URL']}" alt="{item['Dish Name']}" class="menu-image">
|
29 |
+
<h3 class="menu-title">{item['Dish Name']}</h3>
|
30 |
+
<p class="menu-description">{item['Description']}</p>
|
31 |
+
<p class="menu-price"><strong>${item['Price ($)']}</strong></p>
|
32 |
<button onclick="showModal('{item['Dish Name']}')" class="add-button">Add</button>
|
33 |
</div>
|
34 |
"""
|
|
|
52 |
# Main Gradio app
|
53 |
def app():
|
54 |
with gr.Blocks(css="style.css") as demo:
|
55 |
+
gr.Markdown("## Dynamic Menu with Modal Suggestion Page")
|
56 |
|
57 |
+
# Homepage
|
58 |
preference_selector = gr.Radio(
|
59 |
choices=["All", "Vegetarian", "Halal/Non-Veg", "Guilt-Free"],
|
60 |
value="All",
|
|
|
62 |
)
|
63 |
menu_output = gr.HTML(value=filter_menu("All"))
|
64 |
|
65 |
+
# Modal Window
|
66 |
modal = gr.Column(visible=False, elem_classes=["popup"])
|
67 |
modal_image = gr.Image(label="Dish Image")
|
68 |
modal_name = gr.Markdown()
|