DSatishchandra commited on
Commit
ef9f784
·
verified ·
1 Parent(s): 95a15e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -21,12 +21,12 @@ def generate_food_menu():
21
  html_content = "<div>"
22
  for item in food_items:
23
  html_content += f"""
24
- <div class="menu-item">
25
  <h3>{item['name']}</h3>
26
  <p>{item['price']}</p>
27
  <p>{item['description']}</p>
28
- <img src="{item['image']}" alt="{item['name']}" class="menu-image" onclick="openPopup('{item['name']}', '{item['price']}', '{item['description']}', '{item['image']}')">
29
- <button class="add-btn" onclick="openPopup('{item['name']}', '{item['price']}', '{item['description']}', '{item['image']}')">Add</button>
30
  </div>
31
  """
32
  html_content += "</div>"
@@ -54,13 +54,13 @@ with gr.Blocks() as demo:
54
  with gr.Row():
55
  gr.HTML(generate_food_menu()) # Render food menu
56
  gr.HTML("""
57
- <div id="popup" class="popup" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0, 0, 0, 0.8); display:flex; justify-content:center; align-items:center;">
58
- <div class="popup-content" style="background:#fff; padding:20px; border-radius:10px; width:50%; text-align:center;">
59
- <img id="popup-image" src="" alt="Food Image" style="width:100%; border-radius:10px;">
60
- <h2 id="popup-name"></h2>
61
- <p id="popup-price"></p>
62
- <p id="popup-description"></p>
63
- <button onclick="closePopup()" style="margin-top:20px; padding:10px 20px; background:red; color:#fff; border:none; border-radius:5px; cursor:pointer;">Close</button>
64
  </div>
65
  </div>
66
  """)
 
21
  html_content = "<div>"
22
  for item in food_items:
23
  html_content += f"""
24
+ <div class=\"menu-item\">
25
  <h3>{item['name']}</h3>
26
  <p>{item['price']}</p>
27
  <p>{item['description']}</p>
28
+ <img src=\"{item['image']}\" alt=\"{item['name']}\" class=\"menu-image\" onclick=\"openPopup('{item['name']}', '{item['price']}', '{item['description']}', '{item['image']}')\">
29
+ <button class=\"add-btn\" onclick=\"openPopup('{item['name']}', '{item['price']}', '{item['description']}', '{item['image']}')\">Add</button>
30
  </div>
31
  """
32
  html_content += "</div>"
 
54
  with gr.Row():
55
  gr.HTML(generate_food_menu()) # Render food menu
56
  gr.HTML("""
57
+ <div id=\"popup\" class=\"popup\" style=\"display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0, 0, 0, 0.8); display:flex; justify-content:center; align-items:center;\">
58
+ <div class=\"popup-content\" style=\"background:#fff; padding:20px; border-radius:10px; width:50%; text-align:center;\">
59
+ <img id=\"popup-image\" src=\"\" alt=\"Food Image\" style=\"width:100%; border-radius:10px;\">
60
+ <h2 id=\"popup-name\"></h2>
61
+ <p id=\"popup-price\"></p>
62
+ <p id=\"popup-description\"></p>
63
+ <button onclick=\"closePopup()\" style=\"margin-top:20px; padding:10px 20px; background:red; color:#fff; border:none; border-radius:5px; cursor:pointer;\">Close</button>
64
  </div>
65
  </div>
66
  """)