Spaces:
Sleeping
Sleeping
File size: 629 Bytes
dccd44d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from utils.state_management import state
def cart_page():
def view_cart():
cart = state.get("cart", [])
return cart
def remove_item(item_name):
cart = state.get("cart", [])
cart = [item for item in cart if item["Item"] != item_name]
state["cart"] = cart
return "Item removed!"
with gr.Group():
gr.Markdown("### Cart")
cart_items = view_cart()
for item in cart_items:
gr.Text(f"{item['Item']} - {item['Spice Level']}")
gr.Button("Remove").click(remove_item, inputs=[item["Item"]], outputs="Status")
|