Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -160,7 +160,7 @@ def process_audio():
|
|
| 160 |
def process_command(command):
|
| 161 |
global cart
|
| 162 |
command = command.lower()
|
| 163 |
-
all_items = {item: price for category in MENU.
|
| 164 |
|
| 165 |
if "menu" in command:
|
| 166 |
menu = ", ".join([f"{category}: {', '.join(items.keys())}" for category, items in MENU.items()])
|
|
@@ -168,16 +168,17 @@ def process_command(command):
|
|
| 168 |
elif any(item in command for item in all_items.keys()):
|
| 169 |
item = next((item for item in all_items.keys() if item in command), None)
|
| 170 |
if item:
|
| 171 |
-
|
|
|
|
| 172 |
total = sum(item[1] for item in cart)
|
| 173 |
cart_summary = ", ".join([f"{i[0]} (₹{i[1]})" for i in cart])
|
| 174 |
-
return f"{item.
|
| 175 |
elif "final order" in command or "submit" in command:
|
| 176 |
if cart:
|
| 177 |
items = ", ".join([f"{item[0]} (₹{item[1]})" for item in cart])
|
| 178 |
total = sum(item[1] for item in cart)
|
| 179 |
-
cart.clear()
|
| 180 |
-
return f"Your final order is: {items}.
|
| 181 |
else:
|
| 182 |
return "Your cart is empty. Please add items first."
|
| 183 |
elif "no" in command or "nothing" in command or "goodbye" in command:
|
|
|
|
| 160 |
def process_command(command):
|
| 161 |
global cart
|
| 162 |
command = command.lower()
|
| 163 |
+
all_items = {item.lower(): (category, price) for category, items in MENU.items() for item, price in items.items()}
|
| 164 |
|
| 165 |
if "menu" in command:
|
| 166 |
menu = ", ".join([f"{category}: {', '.join(items.keys())}" for category, items in MENU.items()])
|
|
|
|
| 168 |
elif any(item in command for item in all_items.keys()):
|
| 169 |
item = next((item for item in all_items.keys() if item in command), None)
|
| 170 |
if item:
|
| 171 |
+
category, price = all_items[item]
|
| 172 |
+
cart.append((item.title(), price))
|
| 173 |
total = sum(item[1] for item in cart)
|
| 174 |
cart_summary = ", ".join([f"{i[0]} (₹{i[1]})" for i in cart])
|
| 175 |
+
return f"{item.title()} added to your cart. Your cart: {cart_summary}. Total: ₹{total}."
|
| 176 |
elif "final order" in command or "submit" in command:
|
| 177 |
if cart:
|
| 178 |
items = ", ".join([f"{item[0]} (₹{item[1]})" for item in cart])
|
| 179 |
total = sum(item[1] for item in cart)
|
| 180 |
+
cart.clear()
|
| 181 |
+
return f"Your final order is: {items}. Total price: ₹{total}. Thank you for ordering!"
|
| 182 |
else:
|
| 183 |
return "Your cart is empty. Please add items first."
|
| 184 |
elif "no" in command or "nothing" in command or "goodbye" in command:
|