Rammohan0504 commited on
Commit
c24cdbf
·
verified ·
1 Parent(s): a85f408

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -18
app.py CHANGED
@@ -151,7 +151,7 @@ popup_html = """
151
  def display_dishes(category):
152
  html_content = "<div style='display: flex; flex-direction: column; gap: 20px; padding-bottom: 20px; box-sizing: border-box;'>"
153
  for dish in menu_data:
154
- if category == "ALL":
155
  html_content += f"""
156
  <div style='display: flex; align-items: center; justify-content: space-between; padding: 20px; border: 1px solid #ddd; border-radius: 10px; background-color: #f9f9f9;'>
157
  <div style='flex: 3; text-align: left;'>
@@ -166,27 +166,11 @@ def display_dishes(category):
166
  Add
167
  </button>
168
  </div>
169
-
170
- elif category == dish["category"] == category:
171
- html_content += f"""
172
- <div style='display: flex; align-items: center; justify-content: space-between; padding: 20px; height:100%; border: 1px solid #ddd; border-radius: 10px; background-color: #f9f9f9;'>
173
- <div style='flex: 3; text-align: left;'>
174
- <h3 style='margin: 0; font-size: 20px;'>{dish['name']}</h3>
175
- <p style='margin: 5px 0; font-size: 14px; color: #555;'>{dish['description']}</p>
176
- <p style='margin: 0; font-size: 16px; font-weight: bold;'>Price: {dish['price']}</p>
177
- </div>
178
- <div style='flex: 1; text-align: center;'>
179
- <img src='{dish['image']}' alt='{dish['name']}' style='width: 120px; height: 80px; object-fit: cover; border-radius: 10px;'>
180
- <button onclick="showPopup('{dish['name']}', '{dish['description']}', '{dish['price']}', '{dish['image']}')"
181
- style='margin-top: 10px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;'>
182
- Add
183
- </button>
184
- </div>
185
  </div>
186
  """
187
  html_content += "</div>"
188
  return html_content
189
-
190
  # Main Gradio App
191
  with gr.Blocks (css="#dish-container {min-height: 100vh; overflow-y: auto;}") as demo:
192
  gr.HTML(popup_html) # Add the popup container and overlay
 
151
  def display_dishes(category):
152
  html_content = "<div style='display: flex; flex-direction: column; gap: 20px; padding-bottom: 20px; box-sizing: border-box;'>"
153
  for dish in menu_data:
154
+ if category == "ALL" or category == dish["category"]:
155
  html_content += f"""
156
  <div style='display: flex; align-items: center; justify-content: space-between; padding: 20px; border: 1px solid #ddd; border-radius: 10px; background-color: #f9f9f9;'>
157
  <div style='flex: 3; text-align: left;'>
 
166
  Add
167
  </button>
168
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  </div>
170
  """
171
  html_content += "</div>"
172
  return html_content
173
+
174
  # Main Gradio App
175
  with gr.Blocks (css="#dish-container {min-height: 100vh; overflow-y: auto;}") as demo:
176
  gr.HTML(popup_html) # Add the popup container and overlay