geethareddy commited on
Commit
b1339aa
·
verified ·
1 Parent(s): 150078c

Update components/popup_card.py

Browse files
Files changed (1) hide show
  1. components/popup_card.py +14 -11
components/popup_card.py CHANGED
@@ -1,14 +1,17 @@
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() 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
 
 
 
 
 
 
 
 
1
  def generate_popup_card(name, model_path):
2
  """
3
+ Generates an HTML popup card dynamically for the selected menu item.
4
  """
5
+ html_content = f"""
6
+ <div style="border: 1px solid #ddd; padding: 20px; border-radius: 10px; background-color: #fff;">
7
+ <h2>{name}</h2>
8
+ <model-viewer src="{model_path}" alt="3D Model of {name}" camera-controls auto-rotate></model-viewer>
9
+ <label for="instructions">Special Instructions:</label>
10
+ <textarea id="instructions" placeholder="Add any requests here..."></textarea>
11
+ <label for="quantity">Quantity:</label>
12
+ <input type="number" id="quantity" min="1" max="10" value="1">
13
+ <button style="margin-top: 10px;">Add to Cart</button>
14
+ <button style="margin-left: 10px; background-color: #ccc;">Close</button>
15
+ </div>
16
+ """
17
+ return html_content