geethareddy commited on
Commit
7fa45fb
·
verified ·
1 Parent(s): b2bd947

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
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.values() for item, price in category.items()}
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
- cart.append((item, all_items[item]))
 
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.capitalize()} added to your cart. Your cart: {cart_summary}. Total: ₹{total}."
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() # Reset cart after final order
180
- return f"Your final order is: {items}. The total price is ₹{total}. Thank you for ordering!"
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: