Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,37 +1,36 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from components.menu import generate_menu
|
| 3 |
-
from components.
|
|
|
|
| 4 |
import pandas as pd
|
| 5 |
|
| 6 |
# Load menu data
|
| 7 |
-
menu_data = pd.read_excel("data/menu.xlsx")
|
| 8 |
|
| 9 |
def main():
|
| 10 |
with gr.Blocks(css="static/styles.css") as app:
|
| 11 |
-
gr.Markdown("# Dynamic Menu with Popups and
|
| 12 |
-
|
| 13 |
# Preference Selection
|
| 14 |
preference = gr.Radio(
|
| 15 |
-
label="
|
| 16 |
choices=["All", "Vegetarian", "Non-Vegetarian", "Guilt-Free"],
|
| 17 |
value="All"
|
| 18 |
)
|
| 19 |
-
|
| 20 |
-
# Menu Display
|
| 21 |
-
menu_display = gr.Column()
|
| 22 |
-
|
| 23 |
-
# Update menu dynamically based on preference
|
| 24 |
-
def update_menu(preference_value):
|
| 25 |
-
return generate_menu(preference_value, menu_data)
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# Popup Display
|
| 30 |
-
popup_display = gr.Column(visible=False) # Placeholder for
|
| 31 |
|
| 32 |
-
# Cart
|
| 33 |
gr.Markdown("## Your Cart")
|
| 34 |
-
cart_display = gr.Dataframe(
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
app.launch()
|
| 37 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from components.menu import generate_menu
|
| 3 |
+
from components.popup import show_popup
|
| 4 |
+
from components.cart import display_cart, cart_data
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
# Load menu data
|
| 8 |
+
menu_data = pd.read_excel("data/menu.xlsx")
|
| 9 |
|
| 10 |
def main():
|
| 11 |
with gr.Blocks(css="static/styles.css") as app:
|
| 12 |
+
gr.Markdown("# Dynamic Menu with Popups and Ordering System")
|
| 13 |
+
|
| 14 |
# Preference Selection
|
| 15 |
preference = gr.Radio(
|
| 16 |
+
label="Choose a Preference",
|
| 17 |
choices=["All", "Vegetarian", "Non-Vegetarian", "Guilt-Free"],
|
| 18 |
value="All"
|
| 19 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
# Menu Display
|
| 22 |
+
menu_display = gr.Row()
|
| 23 |
+
preference.change(generate_menu, inputs=[preference], outputs=menu_display)
|
| 24 |
|
| 25 |
# Popup Display
|
| 26 |
+
popup_display = gr.Column(visible=False) # Placeholder for popup
|
| 27 |
|
| 28 |
+
# Cart Section
|
| 29 |
gr.Markdown("## Your Cart")
|
| 30 |
+
cart_display = gr.Dataframe(
|
| 31 |
+
value=cart_data(),
|
| 32 |
+
headers=["Dish", "Spice Level", "Extras", "Instructions", "Quantity", "Price"]
|
| 33 |
+
)
|
| 34 |
|
| 35 |
app.launch()
|
| 36 |
|