lokesh341 commited on
Commit
3d80d68
·
verified ·
1 Parent(s): afdd70e

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +7 -23
templates/index.html CHANGED
@@ -48,21 +48,6 @@
48
  color: #ff6a00;
49
  font-weight: bold;
50
  }
51
- .btn {
52
- margin-top: 30px;
53
- padding: 12px;
54
- background-color: #ff6a00;
55
- color: white;
56
- font-size: 18px;
57
- font-weight: bold;
58
- border: none;
59
- border-radius: 5px;
60
- cursor: pointer;
61
- transition: background-color 0.3s;
62
- }
63
- .btn:hover {
64
- background-color: #ff5500;
65
- }
66
  .status {
67
  font-size: 14px;
68
  color: gray;
@@ -111,13 +96,7 @@
111
  window.speechSynthesis.speak(speech);
112
  }
113
 
114
- // Make sure to start listening as soon as the page loads
115
- window.onload = function () {
116
- welcomeMessage(); // Automatically say the welcome message
117
- setTimeout(startListening, 5000); // Start listening after the welcome message
118
- };
119
-
120
- // Function to start listening to voice input
121
  function startListening() {
122
  const status = document.getElementById('status');
123
  const nameInput = document.getElementById('name');
@@ -129,7 +108,6 @@
129
  // Handle recognition results
130
  recognition.onresult = function(event) {
131
  const transcript = event.results[event.resultIndex][0].transcript.trim();
132
- console.log('Recognized Text:', transcript); // Debugging line
133
  if (event.results[event.resultIndex].isFinal) {
134
  if (!isNameCaptured) {
135
  // If name is empty, fill it with the recognized text
@@ -154,6 +132,12 @@
154
  status.textContent = 'Error recognizing speech. Please try again.';
155
  };
156
  }
 
 
 
 
 
 
157
  </script>
158
  </body>
159
  </html>
 
48
  color: #ff6a00;
49
  font-weight: bold;
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  .status {
52
  font-size: 14px;
53
  color: gray;
 
96
  window.speechSynthesis.speak(speech);
97
  }
98
 
99
+ // Function to handle starting the listening process after the welcome message
 
 
 
 
 
 
100
  function startListening() {
101
  const status = document.getElementById('status');
102
  const nameInput = document.getElementById('name');
 
108
  // Handle recognition results
109
  recognition.onresult = function(event) {
110
  const transcript = event.results[event.resultIndex][0].transcript.trim();
 
111
  if (event.results[event.resultIndex].isFinal) {
112
  if (!isNameCaptured) {
113
  // If name is empty, fill it with the recognized text
 
132
  status.textContent = 'Error recognizing speech. Please try again.';
133
  };
134
  }
135
+
136
+ // Make sure to start listening as soon as the page loads
137
+ window.onload = function () {
138
+ welcomeMessage(); // Automatically say the welcome message
139
+ setTimeout(startListening, 5000); // Start listening after the welcome message
140
+ };
141
  </script>
142
  </body>
143
  </html>