Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -148,7 +148,7 @@ popup_html = """
|
|
| 148 |
|
| 149 |
# Generate dish cards
|
| 150 |
def display_dishes(category):
|
| 151 |
-
html_content = "<div style='display: flex; flex-direction: column; gap: 20px;
|
| 152 |
for dish in menu_data:
|
| 153 |
if category == "ALL" or dish["category"] == category:
|
| 154 |
html_content += f"""
|
|
@@ -177,20 +177,27 @@ with gr.Blocks() as demo:
|
|
| 177 |
|
| 178 |
gr.HTML("<h1 style='text-align: center;'>🍛 Biryani Hub Menu 🍛</h1>")
|
| 179 |
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
|
| 186 |
# Dish display
|
| 187 |
dish_display = gr.HTML(value=display_dishes("ALL"))
|
| 188 |
|
| 189 |
-
#
|
| 190 |
-
|
| 191 |
-
lambda
|
| 192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
outputs=dish_display
|
| 194 |
)
|
| 195 |
|
| 196 |
-
demo.launch()
|
|
|
|
| 148 |
|
| 149 |
# Generate dish cards
|
| 150 |
def display_dishes(category):
|
| 151 |
+
html_content = "<div style='display: flex; flex-direction: column; gap: 20px; width: 80%; margin: 0 auto;'>"
|
| 152 |
for dish in menu_data:
|
| 153 |
if category == "ALL" or dish["category"] == category:
|
| 154 |
html_content += f"""
|
|
|
|
| 177 |
|
| 178 |
gr.HTML("<h1 style='text-align: center;'>🍛 Biryani Hub Menu 🍛</h1>")
|
| 179 |
|
| 180 |
+
# Buttons for filtering categories
|
| 181 |
+
with gr.Row():
|
| 182 |
+
btn_all = gr.Button("ALL")
|
| 183 |
+
btn_vegan = gr.Button("VEGAN")
|
| 184 |
+
btn_halal = gr.Button("HALAL")
|
| 185 |
|
| 186 |
# Dish display
|
| 187 |
dish_display = gr.HTML(value=display_dishes("ALL"))
|
| 188 |
|
| 189 |
+
# Button click events
|
| 190 |
+
btn_all.click(
|
| 191 |
+
lambda: gr.update(value=display_dishes("ALL")),
|
| 192 |
+
outputs=dish_display
|
| 193 |
+
)
|
| 194 |
+
btn_vegan.click(
|
| 195 |
+
lambda: gr.update(value=display_dishes("VEGAN")),
|
| 196 |
+
outputs=dish_display
|
| 197 |
+
)
|
| 198 |
+
btn_halal.click(
|
| 199 |
+
lambda: gr.update(value=display_dishes("HALAL")),
|
| 200 |
outputs=dish_display
|
| 201 |
)
|
| 202 |
|
| 203 |
+
demo.launch()
|