Spaces:
Sleeping
Sleeping
Update app.py
Browse files89 unmodified lines909192939394959646 unmodified lines14314414514614714814914614714814915 unmodified lines16516616717116816917017117217317417517689 unmodified lines dish_display = gr.HTML(value=display_dishes("ALL"))
with gr.Tab("Cart"): cart_display = gr.HTML(value="<p>Your cart is empty.</p>") cart_display = gr.HTML(value="<p>Your cart is empty.</p>", elem_id="cart-display")
# JavaScript for managing the pop-up gr.HTML(f"""46 unmodified lines selected_extras: selectedExtras }) }).then(response => response.text()).then(data => { const cartDisplay = document.querySelector('#cart-display'); if (cartDisplay) { cartDisplay.innerHTML = data; } document.getElementById('cart-display').innerHTML = data; document.getElementById('popup').style.display = 'none'; tabs.set_active("Cart"); });15 unmodified lines }) return update_cart()
# Remove standalone cart interface# Correctly integrate cart updates with Gradio@app.post("/add_to_cart")def add_to_cart_api(data: dict): dish_name = data.get("dish_name", "") spice_level = data.get("spice_level", "") selected_extras = data.get("selected_extras", []) return add_to_cart(dish_name, spice_level, selected_extras)
demo.launch()app.py+10-6