dschandra commited on
Commit
d5b9194
·
verified ·
1 Parent(s): d54e93f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -102,8 +102,16 @@ html_code = """
102
  });
103
 
104
  function startConversation() {
105
- status.textContent = 'Listening...';
106
- startListening();
 
 
 
 
 
 
 
 
107
  }
108
 
109
  function startListening() {
@@ -155,7 +163,7 @@ html_code = """
155
  isConversationActive = false;
156
  }
157
  };
158
- setTimeout(() => mediaRecorder.stop(), 10000);
159
  }).catch(() => {
160
  status.textContent = 'Microphone access denied.';
161
  isConversationActive = false;
@@ -237,13 +245,9 @@ def process_command(command):
237
  global user_order
238
 
239
  command = command.lower()
240
-
241
- # Greetings
242
- if "hello" in command or "hi" in command or "hey" in command:
243
- return "Welcome! How can I assist you today? You can ask to see the menu or place an order."
244
 
245
  # Show menu
246
- elif "show me the menu" in command or "what’s the menu" in command:
247
  return (
248
  "Here are the options: \n"
249
  "Vegetarian: Vegetable Biryani, Paneer Butter Masala, Aloo Gobi, Veg Sambar, Veg Korma\n"
 
102
  });
103
 
104
  function startConversation() {
105
+ status.textContent = 'Please listen to the instructions. Once you are ready, I will start listening to your commands.';
106
+ showInstructions();
107
+ }
108
+
109
+ function showInstructions() {
110
+ setTimeout(() => {
111
+ status.textContent = 'Listening...';
112
+ response.style.display = 'none';
113
+ startListening();
114
+ }, 3000); // Wait 3 seconds to ensure user reads instructions
115
  }
116
 
117
  function startListening() {
 
163
  isConversationActive = false;
164
  }
165
  };
166
+ setTimeout(() => mediaRecorder.stop(), 10000); // Wait for 10 seconds of speaking time
167
  }).catch(() => {
168
  status.textContent = 'Microphone access denied.';
169
  isConversationActive = false;
 
245
  global user_order
246
 
247
  command = command.lower()
 
 
 
 
248
 
249
  # Show menu
250
+ if "show me the menu" in command or "what’s the menu" in command:
251
  return (
252
  "Here are the options: \n"
253
  "Vegetarian: Vegetable Biryani, Paneer Butter Masala, Aloo Gobi, Veg Sambar, Veg Korma\n"