Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,20 +53,21 @@ def filter_dishes(category):
|
|
| 53 |
# Function to display dishes
|
| 54 |
def display_dishes(category="ALL"):
|
| 55 |
filtered_dishes = filter_dishes(category)
|
| 56 |
-
html_content = "<div style='display: flex; flex-
|
| 57 |
for dish in filtered_dishes:
|
| 58 |
html_content += f"""
|
| 59 |
-
<div style='border: 1px solid #ddd; padding: 10px; border-radius: 5px; width: 200px;'>
|
| 60 |
-
<img src='{dish['image']}' alt='{dish['name']}' style='width: 100%; height: 150px; object-fit: cover; border-radius: 5px;'>
|
| 61 |
<h4>{dish['name']}</h4>
|
| 62 |
<p>{dish['description']}</p>
|
| 63 |
<p><strong>Price:</strong> ${dish['price']}</p>
|
| 64 |
-
<button onclick="showMenuPopup('{dish['name']}', '{dish['description']}', {dish['price']}, '{dish['image']}')" style='padding: 5px 10px; background-color: #28a745; color: white; border: none; border-radius: 3px;'>Add
|
| 65 |
</div>
|
| 66 |
"""
|
| 67 |
html_content += "</div>"
|
| 68 |
return html_content
|
| 69 |
|
|
|
|
| 70 |
# Main Gradio App
|
| 71 |
with gr.Blocks() as demo:
|
| 72 |
gr.HTML("<h1 style='text-align: center;'>Dynamic Menu with Cart</h1>")
|
|
|
|
| 53 |
# Function to display dishes
|
| 54 |
def display_dishes(category="ALL"):
|
| 55 |
filtered_dishes = filter_dishes(category)
|
| 56 |
+
html_content = "<div style='display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;'>"
|
| 57 |
for dish in filtered_dishes:
|
| 58 |
html_content += f"""
|
| 59 |
+
<div style='border: 1px solid #ddd; padding: 10px; border-radius: 5px; width: 200px; text-align: center;'>
|
| 60 |
+
<img src='{dish['image']}' alt='{dish['name']}' style='width: 100%; height: 150px; object-fit: cover; border-radius: 5px; margin-bottom: 10px;'>
|
| 61 |
<h4>{dish['name']}</h4>
|
| 62 |
<p>{dish['description']}</p>
|
| 63 |
<p><strong>Price:</strong> ${dish['price']}</p>
|
| 64 |
+
<button onclick="showMenuPopup('{dish['name']}', '{dish['description']}', {dish['price']}, '{dish['image']}')" style='padding: 5px 10px; background-color: #28a745; color: white; border: none; border-radius: 3px;'>Add</button>
|
| 65 |
</div>
|
| 66 |
"""
|
| 67 |
html_content += "</div>"
|
| 68 |
return html_content
|
| 69 |
|
| 70 |
+
|
| 71 |
# Main Gradio App
|
| 72 |
with gr.Blocks() as demo:
|
| 73 |
gr.HTML("<h1 style='text-align: center;'>Dynamic Menu with Cart</h1>")
|