geethareddy commited on
Commit
a9e3958
·
verified ·
1 Parent(s): eebcf19

Update components/popup_card.py

Browse files
Files changed (1) hide show
  1. components/popup_card.py +8 -4
components/popup_card.py CHANGED
@@ -1,12 +1,16 @@
1
  import gradio as gr
2
 
3
  def generate_popup_card(name, model_path):
4
- with gr.Blocks() as popup:
 
 
 
5
  gr.Markdown(f"### {name}")
6
  gr.ModelViewer(model_path, label="View in 3D")
7
  gr.Textbox(label="Special Instructions", placeholder="Add any requests here...")
8
- gr.Slider(1, 10, label="Quantity")
9
  gr.Button("Add to Cart")
10
- gr.Button("Close", elem_id="close-popup").click(None, None, "popup-container")
11
-
 
12
  return popup
 
1
  import gradio as gr
2
 
3
  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