dschandra commited on
Commit
0af1f1a
·
verified ·
1 Parent(s): 717f735

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -8
app.py CHANGED
@@ -14,7 +14,16 @@ logging.basicConfig(level=logging.INFO)
14
 
15
  # Initialize conversation state
16
  user_order = [] # Stores the current order
17
- user_preferences = {} # Stores the customer's preferences
 
 
 
 
 
 
 
 
 
18
 
19
  # HTML Template for Frontend
20
  html_code = """
@@ -61,10 +70,6 @@ html_code = """
61
  font-size: 18px;
62
  color: #666;
63
  }
64
- .listening {
65
- color: green;
66
- font-weight: bold;
67
- }
68
  .response {
69
  margin-top: 20px;
70
  padding: 10px;
@@ -155,7 +160,7 @@ html_code = """
155
  isConversationActive = false;
156
  }
157
  };
158
- setTimeout(() => mediaRecorder.stop(), 5000); // Stop recording after 5 seconds
159
  }).catch(() => {
160
  status.textContent = 'Microphone access denied.';
161
  isConversationActive = false;
@@ -240,11 +245,20 @@ def process_command(command):
240
  if "hello" in command or "hi" in command or "hey" in command:
241
  return (
242
  "Welcome! How can I assist you with your meal today? "
243
- "Please let me know your preferences."
244
  )
 
 
 
 
 
 
 
 
 
245
  elif "reset preferences" in command:
246
  user_order = [] # Reset the order
247
- user_preferences = {} # Reset preferences
248
  return "Your preferences have been reset. What would you like to order?"
249
  elif "show my order" in command or "what's my order" in command:
250
  if user_order:
 
14
 
15
  # Initialize conversation state
16
  user_order = [] # Stores the current order
17
+ user_preferences = None # Stores the customer's preferences (Veg, Non-Veg/Halal, or Both)
18
+
19
+ # Define food items
20
+ menu_items = {
21
+ 'Veg': ["Vegetable Biryani", "Paneer Butter Masala", "Aloo Gobi", "Veg Sambar", "Veg Korma"],
22
+ 'Non-Veg': ["Butter Chicken", "Chicken Biryani", "Tandoori Chicken", "Mutton Rogan Josh", "Chicken Korma"],
23
+ 'Both': ["Vegetable Biryani", "Paneer Butter Masala", "Butter Chicken", "Chicken Biryani", "Mutton Rogan Josh", "Tandoori Chicken", "Aloo Gobi", "Veg Sambar", "Veg Korma", "Chicken Korma"],
24
+ 'Drinks': ["Lassi", "Soft Drink", "Lemon Juice", "Iced Tea", "Milkshake"],
25
+ 'Desserts': ["Gulab Jamun", "Kheer", "Ice Cream", "Ras Malai"]
26
+ }
27
 
28
  # HTML Template for Frontend
29
  html_code = """
 
70
  font-size: 18px;
71
  color: #666;
72
  }
 
 
 
 
73
  .response {
74
  margin-top: 20px;
75
  padding: 10px;
 
160
  isConversationActive = false;
161
  }
162
  };
163
+ setTimeout(() => mediaRecorder.stop(), 10000); // Stop recording after 10 seconds
164
  }).catch(() => {
165
  status.textContent = 'Microphone access denied.';
166
  isConversationActive = false;
 
245
  if "hello" in command or "hi" in command or "hey" in command:
246
  return (
247
  "Welcome! How can I assist you with your meal today? "
248
+ "Please let me know your preferences (Veg, Non-Veg/Halal, or Both)."
249
  )
250
+ elif "veg" in command:
251
+ user_preferences = "Veg"
252
+ return "You selected Veg. Here are the options: " + ", ".join(menu_items["Veg"]) + ". What would you like to add?"
253
+ elif "non-veg" in command or "halal" in command:
254
+ user_preferences = "Non-Veg"
255
+ return "You selected Non-Veg/Halal. Here are the options: " + ", ".join(menu_items["Non-Veg"]) + ". What would you like to add?"
256
+ elif "both" in command:
257
+ user_preferences = "Both"
258
+ return "You selected Both. Here are the options: " + ", ".join(menu_items["Both"]) + ". What would you like to add?"
259
  elif "reset preferences" in command:
260
  user_order = [] # Reset the order
261
+ user_preferences = None # Reset preferences
262
  return "Your preferences have been reset. What would you like to order?"
263
  elif "show my order" in command or "what's my order" in command:
264
  if user_order: