geethareddy commited on
Commit
2a3d92b
·
verified ·
1 Parent(s): 026b8b4

Update components/popup_card.py

Browse files
Files changed (1) hide show
  1. components/popup_card.py +3 -5
components/popup_card.py CHANGED
@@ -4,13 +4,11 @@ def generate_popup_card(name, model_path):
4
  """
5
  Generates a popup card dynamically for the selected menu item.
6
  """
7
- with gr.Blocks(visible=False) as popup:
8
  gr.Markdown(f"### {name}")
9
  gr.ModelViewer(model_path, label="View in 3D")
10
  gr.Textbox(label="Special Instructions", placeholder="Add any requests here...")
11
- gr.Slider(minimum=1, maximum=10, value=1, label="Quantity")
12
  gr.Button("Add to Cart")
13
- gr.Button("Close", elem_id="close-popup").click(
14
- None, None, popup.update(visible=False) # Close the popup
15
- )
16
  return popup
 
4
  """
5
  Generates a popup card dynamically for the selected menu item.
6
  """
7
+ with gr.Blocks() as popup:
8
  gr.Markdown(f"### {name}")
9
  gr.ModelViewer(model_path, label="View in 3D")
10
  gr.Textbox(label="Special Instructions", placeholder="Add any requests here...")
11
+ gr.Slider(1, 10, value=1, label="Quantity")
12
  gr.Button("Add to Cart")
13
+ gr.Button("Close").click(lambda: popup.update(visible=False)) # Close the popup dynamically
 
 
14
  return popup