Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
|
|
3 |
|
4 |
# Function to load the menu data from Excel
|
5 |
def load_menu():
|
6 |
-
menu_file = "menu.xlsx" #
|
7 |
try:
|
8 |
return pd.read_excel(menu_file)
|
9 |
except Exception as e:
|
@@ -47,6 +47,9 @@ def filter_menu(preference):
|
|
47 |
# Gradio app definition
|
48 |
def app():
|
49 |
with gr.Blocks(title="Dynamic Menu with Preferences") as demo:
|
|
|
|
|
|
|
50 |
# Radio button for selecting preference
|
51 |
selected_preference = gr.Radio(
|
52 |
choices=["All", "Vegan", "Halal", "Guilt-Free"],
|
@@ -60,12 +63,6 @@ def app():
|
|
60 |
# Define interactivity
|
61 |
selected_preference.change(filter_menu, inputs=[selected_preference], outputs=[menu_output])
|
62 |
|
63 |
-
# Layout
|
64 |
-
gr.Markdown("## Dynamic Menu with Preferences")
|
65 |
-
with gr.Row():
|
66 |
-
selected_preference.render()
|
67 |
-
menu_output.render()
|
68 |
-
|
69 |
return demo
|
70 |
|
71 |
# Run the app
|
|
|
3 |
|
4 |
# Function to load the menu data from Excel
|
5 |
def load_menu():
|
6 |
+
menu_file = "menu.xlsx" # Ensure this file exists in the same directory
|
7 |
try:
|
8 |
return pd.read_excel(menu_file)
|
9 |
except Exception as e:
|
|
|
47 |
# Gradio app definition
|
48 |
def app():
|
49 |
with gr.Blocks(title="Dynamic Menu with Preferences") as demo:
|
50 |
+
# Add a title
|
51 |
+
gr.Markdown("## Dynamic Menu with Preferences")
|
52 |
+
|
53 |
# Radio button for selecting preference
|
54 |
selected_preference = gr.Radio(
|
55 |
choices=["All", "Vegan", "Halal", "Guilt-Free"],
|
|
|
63 |
# Define interactivity
|
64 |
selected_preference.change(filter_menu, inputs=[selected_preference], outputs=[menu_output])
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
return demo
|
67 |
|
68 |
# Run the app
|