Rammohan0504 commited on
Commit
00c4b93
·
verified ·
1 Parent(s): 49cbf87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -16
app.py CHANGED
@@ -1,7 +1,5 @@
1
  import gradio as gr
2
-
3
- # Global variables for cart and menu data
4
- cart = []
5
 
6
  menu_data = [
7
  {"name": "Veg Burger", "category": "VEGAN",
@@ -18,20 +16,7 @@ menu_data = [
18
  "price": "$10.99"}
19
  ]
20
 
21
- # Function to add an item to the cart
22
- def add_to_cart(item_name):
23
- cart.append({"item_name": item_name})
24
- return f"{item_name} added to cart!"
25
 
26
- # Function to display the current cart
27
- def display_cart():
28
- if not cart:
29
- return "Your cart is empty."
30
- cart_content = "<h3>Your Cart:</h3><ul>"
31
- for item in cart:
32
- cart_content += f"<li>{item['item_name']}</li>"
33
- cart_content += "</ul>"
34
- return cart_content
35
 
36
  # Function to generate dish cards
37
  def display_dishes(category):
 
1
  import gradio as gr
2
+ from cart_tab import add_to_cart, display_cart # Import shared cart functions
 
 
3
 
4
  menu_data = [
5
  {"name": "Veg Burger", "category": "VEGAN",
 
16
  "price": "$10.99"}
17
  ]
18
 
 
 
 
 
19
 
 
 
 
 
 
 
 
 
 
20
 
21
  # Function to generate dish cards
22
  def display_dishes(category):