Rammohan0504 commited on
Commit
4f0f7c2
·
verified ·
1 Parent(s): 4a9ccfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -11
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; min-height:100vh; overflow: hidden; width: 80%; box-sizing: border-box; margin: 0;'>"
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
- category_selector = gr.Radio(
181
- ["ALL", "VEGAN", "HALAL"],
182
- label="Select Category",
183
- value="ALL"
184
- )
185
 
186
  # Dish display
187
  dish_display = gr.HTML(value=display_dishes("ALL"))
188
 
189
- # Radio button change event
190
- category_selector.change(
191
- lambda category: gr.update(value=display_dishes(category)),
192
- inputs=category_selector,
 
 
 
 
 
 
 
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()