nagasurendra commited on
Commit
f94a797
·
verified ·
1 Parent(s): 6516f1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -87,10 +87,10 @@ def filter_menu(preference):
87
  if preference == "All" or (preference == "Veg" and item["Veg_NonVeg__c"] in ["Veg", "Both"]) or (preference == "Non-Veg" and item["Veg_NonVeg__c"] in ["Non veg", "Both"]):
88
  filtered_data[item["Section__c"].strip()].append(item)
89
 
90
- html_content = '<div style="padding: 10px; max-width: 1200px; margin: auto;">'
91
  for section, items in filtered_data.items():
92
  if items:
93
- html_content += f"<h2 style='text-align: center; margin-top: 20px;'>{section}</h2>"
94
  html_content += '<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; justify-content: center;">'
95
  for item in items:
96
  html_content += f"""
@@ -116,13 +116,11 @@ with gr.Blocks() as app:
116
  with gr.Row():
117
  gr.HTML("<h1 style='text-align: center;'>Welcome to Biryani Hub</h1>")
118
 
119
- with gr.Row(visible=True) as login_page:
120
- with gr.Column():
121
- login_email = gr.Textbox(label="Email")
122
- login_password = gr.Textbox(label="Password", type="password")
123
- login_button = gr.Button("Login")
124
- signup_button = gr.Button("Go to Signup")
125
- login_output = gr.Textbox(label="Status")
126
 
127
  with gr.Row(visible=False) as signup_page:
128
  with gr.Column():
@@ -134,10 +132,6 @@ with gr.Blocks() as app:
134
  login_redirect = gr.Button("Go to Login")
135
  signup_output = gr.Textbox(label="Status")
136
 
137
- with gr.Row(visible=False) as menu_page:
138
- preference = gr.Radio(choices=["All", "Veg", "Non-Veg"], label="Filter Preference", value="All")
139
- menu_output = gr.HTML()
140
-
141
  with gr.Row(visible=False) as footer:
142
  gr.HTML("<footer style='text-align: center;'>Thank you! Welcome again!</footer>")
143
 
@@ -156,11 +150,6 @@ with gr.Blocks() as app:
156
  content = filter_menu(preference)
157
  return content
158
 
159
- login_button.click(
160
- handle_login, [login_email, login_password], [login_page, menu_page, footer, menu_output, login_output]
161
- )
162
- signup_button.click(lambda: (gr.update(visible=False), gr.update(visible=True)), None, [login_page, signup_page])
163
- submit_signup.click(handle_signup, [signup_name, signup_email, signup_phone, signup_password], signup_output)
164
  preference.change(handle_menu, [preference], menu_output)
165
 
166
  app.launch()
 
87
  if preference == "All" or (preference == "Veg" and item["Veg_NonVeg__c"] in ["Veg", "Both"]) or (preference == "Non-Veg" and item["Veg_NonVeg__c"] in ["Non veg", "Both"]):
88
  filtered_data[item["Section__c"].strip()].append(item)
89
 
90
+ html_content = '<div style="padding: 0 10px; max-width: 1200px; margin: auto;">'
91
  for section, items in filtered_data.items():
92
  if items:
93
+ html_content += f"<h2 style='text-align: center; margin-top: 10px;'>{section}</h2>"
94
  html_content += '<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; justify-content: center;">'
95
  for item in items:
96
  html_content += f"""
 
116
  with gr.Row():
117
  gr.HTML("<h1 style='text-align: center;'>Welcome to Biryani Hub</h1>")
118
 
119
+ with gr.Row():
120
+ preference = gr.Radio(choices=["All", "Veg", "Non-Veg"], label="Filter Preference", value="All")
121
+
122
+ with gr.Row(visible=True) as menu_page:
123
+ menu_output = gr.HTML()
 
 
124
 
125
  with gr.Row(visible=False) as signup_page:
126
  with gr.Column():
 
132
  login_redirect = gr.Button("Go to Login")
133
  signup_output = gr.Textbox(label="Status")
134
 
 
 
 
 
135
  with gr.Row(visible=False) as footer:
136
  gr.HTML("<footer style='text-align: center;'>Thank you! Welcome again!</footer>")
137
 
 
150
  content = filter_menu(preference)
151
  return content
152
 
 
 
 
 
 
153
  preference.change(handle_menu, [preference], menu_output)
154
 
155
  app.launch()