Rammohan0504 commited on
Commit
502df1d
·
verified ·
1 Parent(s): a0aab17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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 = gr.State([])
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
- add_to_cart_interface = gr.Interface(
71
  fn=add_to_cart,
72
- inputs=[gr.State(cart), gr.Textbox(label="Dish Name")],
73
- outputs=[gr.State(cart), cart_display]
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;'>