Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -79,10 +79,6 @@ def update_cart():
|
|
79 |
cart_html += f"</ul><p><strong>Total Bill: ${total_bill:.2f}</strong></p>"
|
80 |
return cart_html
|
81 |
|
82 |
-
# Redirect to cart details page
|
83 |
-
def redirect_to_cart():
|
84 |
-
return update_cart()
|
85 |
-
|
86 |
# Gradio app definition
|
87 |
def app():
|
88 |
with gr.Blocks() as demo:
|
@@ -99,12 +95,7 @@ def app():
|
|
99 |
menu_output = gr.HTML(value=filter_menu("All"))
|
100 |
|
101 |
# Floating cart display
|
102 |
-
cart_output = gr.HTML(value=
|
103 |
-
|
104 |
-
# View Cart Page
|
105 |
-
cart_page = gr.HTML(value="Your cart is empty.")
|
106 |
-
view_cart_button = gr.Button("View Cart")
|
107 |
-
view_cart_button.click(fn=redirect_to_cart, outputs=cart_page)
|
108 |
|
109 |
# JavaScript for modal and cart behavior
|
110 |
modal_and_cart_js = """
|
@@ -224,8 +215,6 @@ def app():
|
|
224 |
gr.Row([selected_preference])
|
225 |
gr.Row(menu_output)
|
226 |
gr.Row(cart_output)
|
227 |
-
gr.Row(cart_page)
|
228 |
-
gr.Row([view_cart_button])
|
229 |
gr.Row(modal_window)
|
230 |
gr.HTML(modal_and_cart_js)
|
231 |
|
|
|
79 |
cart_html += f"</ul><p><strong>Total Bill: ${total_bill:.2f}</strong></p>"
|
80 |
return cart_html
|
81 |
|
|
|
|
|
|
|
|
|
82 |
# Gradio app definition
|
83 |
def app():
|
84 |
with gr.Blocks() as demo:
|
|
|
95 |
menu_output = gr.HTML(value=filter_menu("All"))
|
96 |
|
97 |
# Floating cart display
|
98 |
+
cart_output = gr.HTML(value=update_cart(), elem_id="floating-cart")
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
# JavaScript for modal and cart behavior
|
101 |
modal_and_cart_js = """
|
|
|
215 |
gr.Row([selected_preference])
|
216 |
gr.Row(menu_output)
|
217 |
gr.Row(cart_output)
|
|
|
|
|
218 |
gr.Row(modal_window)
|
219 |
gr.HTML(modal_and_cart_js)
|
220 |
|