Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def generate_popup_card(name, model_path): | |
| """ | |
| Generates a popup card dynamically for the selected menu item. | |
| """ | |
| with gr.Blocks() as popup: | |
| gr.Markdown(f"### {name}") | |
| gr.ModelViewer(model_path, label="View in 3D") | |
| gr.Textbox(label="Special Instructions", placeholder="Add any requests here...") | |
| gr.Slider(1, 10, value=1, label="Quantity") | |
| gr.Button("Add to Cart") | |
| gr.Button("Close").click(lambda: popup.update(visible=False)) # Close the popup dynamically | |
| return popup | |