Spaces:
Sleeping
Sleeping
Update components/popup_card.py
Browse files- 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 |
-
|
|
|
|
|
|
|
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(
|
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
|