Rammohan0504 commited on
Commit
10ccfdf
·
verified ·
1 Parent(s): 6455ae4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -146,6 +146,7 @@ popup_html = """
146
  </div>
147
  """
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: auto;'>"
@@ -153,24 +154,23 @@ def display_dishes(category):
153
  if category == "ALL" or dish["category"] == category:
154
  html_content += f"""
155
  <div style='display: flex; align-items: center; justify-content: space-between; padding: 20px; border: 1px solid #ddd; border-radius: 10px; background-color: #f9f9f9;'>
 
 
 
 
 
 
 
156
  <div style='flex: 3; text-align: left;'>
157
  <h3 style='margin: 0; font-size: 20px;'>{dish['name']}</h3>
158
  <p style='margin: 5px 0; font-size: 14px; color: #555;'>{dish['description']}</p>
159
  <p style='margin: 0; font-size: 16px; font-weight: bold;'>Price: {dish['price']}</p>
160
  </div>
161
- <div style='flex: 1; flex-direction: row; text-align: center;'>
162
- <img src='{dish['image']}' alt='{dish['name']}' style='width: 120px; height: 80px; object-fit: cover; border-radius: 10px;'>
163
- <button onclick="showPopup('{dish['name']}', '{dish['description']}', '{dish['price']}', '{dish['image']}')"
164
- style='margin-top: 10px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;'>
165
- Add
166
- </button>
167
- </div>
168
  </div>
169
  """
170
  html_content += "</div>"
171
  return html_content
172
 
173
-
174
  # Main Gradio App
175
  with gr.Blocks() as demo:
176
  gr.HTML(popup_html) # Add the popup container and overlay
 
146
  </div>
147
  """
148
 
149
+ # Generate dish cards
150
  # Generate dish cards
151
  def display_dishes(category):
152
  html_content = "<div style='display: flex; flex-direction: column; gap: 20px; width: 80%; margin: auto;'>"
 
154
  if category == "ALL" or dish["category"] == 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: 1; display: flex; align-items: center;'>
158
+ <img src='{dish['image']}' alt='{dish['name']}' style='width: 120px; height: 80px; object-fit: cover; border-radius: 10px; margin-right: 20px;'>
159
+ <button onclick="showPopup('{dish['name']}', '{dish['description']}', '{dish['price']}', '{dish['image']}')"
160
+ style='padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;'>
161
+ Add
162
+ </button>
163
+ </div>
164
  <div style='flex: 3; text-align: left;'>
165
  <h3 style='margin: 0; font-size: 20px;'>{dish['name']}</h3>
166
  <p style='margin: 5px 0; font-size: 14px; color: #555;'>{dish['description']}</p>
167
  <p style='margin: 0; font-size: 16px; font-weight: bold;'>Price: {dish['price']}</p>
168
  </div>
 
 
 
 
 
 
 
169
  </div>
170
  """
171
  html_content += "</div>"
172
  return html_content
173
 
 
174
  # Main Gradio App
175
  with gr.Blocks() as demo:
176
  gr.HTML(popup_html) # Add the popup container and overlay