Rammohan0504 commited on
Commit
19e277d
·
verified ·
1 Parent(s): 7ef6da6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -98,33 +98,33 @@ popup_js = """
98
  function showPopup(name, description, price, image) {
99
  const popup = document.getElementById("custom-popup");
100
  const overlay = document.getElementById("overlay");
101
- popup.innerHTML =
102
- <img src="${image}" alt="${name}" style="width: auto; height: 250px; border-radius: 10px; margin-bottom: 10px;">
103
  <h3 style="margin-top: 10px;">${name}</h3>
104
  <p>${description}</p>
105
  <p style="font-weight: bold;">Price: ${price}</p>
106
 
107
  <h4 style="margin-top: 20px;">Choose a Spice Level</h4>
108
  <div style="display: flex; flex-wrap: wrap; gap: 10px;">
109
- ${["American Mild", "American Medium", "American Spicy", "Indian Mild", "Indian Medium", "Indian Spicy", "Indian Very Spicy"].map(spice =>
110
  <label style="margin-right: 10px;">
111
  <input type="radio" name="spice" value="${spice}"> ${spice}
112
  </label>
113
- ).join("")}
114
  </div>
115
 
116
  <h4 style="margin-top: 20px;">Choose Extras</h4>
117
  <div style="display: flex; flex-wrap: wrap; gap: 10px;">
118
- ${["Extra Raitha 4oz + $1.00", "Extra Raitha 8oz + $2.00", "Extra Onion + $1.00", "Extra Onion & Lemon + $2.00"].map(extra =>
119
  <label style="margin-right: 10px;">
120
  <input type="checkbox" name="extras" value="${extra}"> ${extra}
121
  </label>
122
- ).join("")}
123
  </div>
124
 
125
  <button onclick="closePopup()" style="margin-top: 20px; padding: 10px 20px; background-color: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer;">Add to Cart</button>
126
  <button onclick="closePopup()" style="margin-top: 20px; margin-left: 10px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;">Close</button>
127
- ;
128
  popup.style.display = "block";
129
  overlay.style.display = "block";
130
  }
@@ -142,13 +142,13 @@ popup_js = """
142
  popup_html = """
143
  <div id="overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; z-index: 999;"></div>
144
  <div id="custom-popup"
145
- style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 60%; max-width: 600px; background: white; padding: 20px; border-radius: 10px; box-shadow: 0px 4px 6px rgba(0,0,0,0.1); display: none; z-index: 1000; text-align: center;">
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;'>"
152
  for dish in menu_data:
153
  if category == "ALL" or dish["category"] == category:
154
  html_content += f"""
@@ -200,5 +200,4 @@ with gr.Blocks() as demo:
200
  outputs=dish_display
201
  )
202
 
203
- demo.launch()
204
-
 
98
  function showPopup(name, description, price, image) {
99
  const popup = document.getElementById("custom-popup");
100
  const overlay = document.getElementById("overlay");
101
+ popup.innerHTML = `
102
+ <img src="${image}" alt="${name}" style="width: 200px; height: auto; border-radius: 10px; margin-bottom: 10px;">
103
  <h3 style="margin-top: 10px;">${name}</h3>
104
  <p>${description}</p>
105
  <p style="font-weight: bold;">Price: ${price}</p>
106
 
107
  <h4 style="margin-top: 20px;">Choose a Spice Level</h4>
108
  <div style="display: flex; flex-wrap: wrap; gap: 10px;">
109
+ ${["American Mild", "American Medium", "American Spicy", "Indian Mild", "Indian Medium", "Indian Spicy", "Indian Very Spicy"].map(spice => `
110
  <label style="margin-right: 10px;">
111
  <input type="radio" name="spice" value="${spice}"> ${spice}
112
  </label>
113
+ `).join("")}
114
  </div>
115
 
116
  <h4 style="margin-top: 20px;">Choose Extras</h4>
117
  <div style="display: flex; flex-wrap: wrap; gap: 10px;">
118
+ ${["Extra Raitha 4oz + $1.00", "Extra Raitha 8oz + $2.00", "Extra Onion + $1.00", "Extra Onion & Lemon + $2.00"].map(extra => `
119
  <label style="margin-right: 10px;">
120
  <input type="checkbox" name="extras" value="${extra}"> ${extra}
121
  </label>
122
+ `).join("")}
123
  </div>
124
 
125
  <button onclick="closePopup()" style="margin-top: 20px; padding: 10px 20px; background-color: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer;">Add to Cart</button>
126
  <button onclick="closePopup()" style="margin-top: 20px; margin-left: 10px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;">Close</button>
127
+ `;
128
  popup.style.display = "block";
129
  overlay.style.display = "block";
130
  }
 
142
  popup_html = """
143
  <div id="overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; z-index: 999;"></div>
144
  <div id="custom-popup"
145
+ style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 50%; max-width: 400px; background: white; padding: 20px; border-radius: 10px; box-shadow: 0px 4px 6px rgba(0,0,0,0.1); display: none; z-index: 1000; text-align: center;">
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: 0 auto;'>"
152
  for dish in menu_data:
153
  if category == "ALL" or dish["category"] == category:
154
  html_content += f"""
 
200
  outputs=dish_display
201
  )
202
 
203
+ demo.launch()