SathvikGanta commited on
Commit
bcfa5dd
·
verified ·
1 Parent(s): 703229c

Update components/popup.py

Browse files
Files changed (1) hide show
  1. components/popup.py +13 -31
components/popup.py CHANGED
@@ -1,37 +1,23 @@
1
  import gradio as gr
2
  from components.cart import add_to_cart
3
 
4
- def show_popup(dish_name, menu_data):
5
- """Displays the popup for the selected menu item."""
6
- dish = menu_data[menu_data['Dish Name'] == dish_name].iloc[0]
7
- popup = gr.Column([
8
- gr.Markdown(f"### {dish_name} - ${dish['Price']}"),
9
- gr.Image(f"static/images/{dish['Image']}"),
10
- gr.Markdown(f"{dish['Description']}"),
11
-
12
- # Spice Level
13
  gr.Radio(
14
- label="Choose a spice level (Required)",
15
- choices=["American Mild", "American Medium", "American Spicy",
16
- "Indian Mild", "Indian Medium", "Indian Very Spicy"],
17
- value="Indian Medium"
18
  ),
19
-
20
- # Extras
21
  gr.CheckboxGroup(
22
- label="Biryani Extras (Optional)",
23
- choices=["Extra Raita 4oz + $1.00", "Extra Raita 8oz + $2.00",
24
- "Extra Salan 8oz + $2.00", "Extra Onion + $1.00",
25
- "Extra Onion & Lemon + $2.00", "Extra Fried Onion 4oz + $2.00"]
26
  ),
27
-
28
- # Special Instructions
29
  gr.Textbox(
30
  label="Special Instructions",
31
- placeholder="Add any requests here."
32
  ),
33
-
34
- # Quantity
35
  gr.Slider(
36
  label="Quantity",
37
  minimum=1,
@@ -39,12 +25,8 @@ def show_popup(dish_name, menu_data):
39
  step=1,
40
  value=1
41
  ),
42
-
43
- # Add to Cart Button
44
- gr.Button("Add to Bag").click(
45
- add_to_cart,
46
- inputs=[dish_name, gr.Radio, gr.CheckboxGroup, gr.Textbox, gr.Slider],
47
- outputs="cart_display"
48
  )
49
  ])
50
- return popup
 
1
  import gradio as gr
2
  from components.cart import add_to_cart
3
 
4
+ def show_popup(dish_name):
5
+ """Display a popup for the selected dish."""
6
+ popup_content = gr.Column([
7
+ gr.Markdown(f"### {dish_name}"),
 
 
 
 
 
8
  gr.Radio(
9
+ label="Choose a Spice Level",
10
+ choices=["Mild", "Medium", "Spicy"],
11
+ value="Medium"
 
12
  ),
 
 
13
  gr.CheckboxGroup(
14
+ label="Extras",
15
+ choices=["Extra Raita + $1.00", "Extra Onion + $1.00"]
 
 
16
  ),
 
 
17
  gr.Textbox(
18
  label="Special Instructions",
19
+ placeholder="Add any specific instructions."
20
  ),
 
 
21
  gr.Slider(
22
  label="Quantity",
23
  minimum=1,
 
25
  step=1,
26
  value=1
27
  ),
28
+ gr.Button("Add to Cart").click(
29
+ add_to_cart, inputs=[dish_name, gr.Radio, gr.CheckboxGroup, gr.Textbox, gr.Slider], outputs="cart_display"
 
 
 
 
30
  )
31
  ])
32
+ return popup_content