dschandra commited on
Commit
78200a1
·
verified ·
1 Parent(s): fa52bb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -63,8 +63,7 @@ def display_menu():
63
  <h4 style="margin: 0;">{item['name']} - ${item['price']}</h4>
64
  <p style="font-size: 12px; color: gray;">{item['description']}</p>
65
  </div>
66
- <button style="background-color: #28a745; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; margin-left: auto;"
67
- onclick="add_to_cart('{item['name']}')">Add</button>
68
  </div>
69
  """
70
  return menu_html
@@ -111,8 +110,8 @@ with gr.Blocks() as demo:
111
  add_button = gr.Button("Add to Cart", visible=False)
112
  add_button.click(fn=add_to_cart, inputs=item_name_input, outputs=[menu_html, cart_summary])
113
 
114
- # Display Menu and Cart Summary
115
- demo.append(menu_html)
116
- demo.append(cart_summary)
117
 
118
  demo.launch()
 
63
  <h4 style="margin: 0;">{item['name']} - ${item['price']}</h4>
64
  <p style="font-size: 12px; color: gray;">{item['description']}</p>
65
  </div>
66
+ <button style="background-color: #28a745; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; margin-left: auto;">Add</button>
 
67
  </div>
68
  """
69
  return menu_html
 
110
  add_button = gr.Button("Add to Cart", visible=False)
111
  add_button.click(fn=add_to_cart, inputs=item_name_input, outputs=[menu_html, cart_summary])
112
 
113
+ # Add Menu and Cart Summary to Gradio Blocks
114
+ menu_html
115
+ cart_summary
116
 
117
  demo.launch()