Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,7 +47,7 @@ def display_dishes(category="ALL"):
|
|
| 47 |
|
| 48 |
# Main Gradio App
|
| 49 |
with gr.Blocks() as demo:
|
| 50 |
-
cart =
|
| 51 |
|
| 52 |
gr.HTML("<h1 style='text-align: center;'>Dynamic Menu with Cart</h1>")
|
| 53 |
|
|
@@ -67,11 +67,11 @@ with gr.Blocks() as demo:
|
|
| 67 |
cart.append(dish_name)
|
| 68 |
return cart, update_cart(cart)
|
| 69 |
|
| 70 |
-
|
| 71 |
fn=add_to_cart,
|
| 72 |
-
inputs=[gr.
|
| 73 |
-
outputs=[gr.
|
| 74 |
-
)
|
| 75 |
|
| 76 |
gr.HTML("""
|
| 77 |
<div id='cart-icon' style='position: fixed; top: 10px; right: 10px; cursor: pointer;'>
|
|
|
|
| 47 |
|
| 48 |
# Main Gradio App
|
| 49 |
with gr.Blocks() as demo:
|
| 50 |
+
cart = [] # Initialize cart as a plain list
|
| 51 |
|
| 52 |
gr.HTML("<h1 style='text-align: center;'>Dynamic Menu with Cart</h1>")
|
| 53 |
|
|
|
|
| 67 |
cart.append(dish_name)
|
| 68 |
return cart, update_cart(cart)
|
| 69 |
|
| 70 |
+
gr.Interface(
|
| 71 |
fn=add_to_cart,
|
| 72 |
+
inputs=[gr.Textbox(label="Cart", lines=2, value="[]"), gr.Textbox(label="Dish Name")],
|
| 73 |
+
outputs=[gr.Textbox(label="Updated Cart"), cart_display]
|
| 74 |
+
).launch()
|
| 75 |
|
| 76 |
gr.HTML("""
|
| 77 |
<div id='cart-icon' style='position: fixed; top: 10px; right: 10px; cursor: pointer;'>
|