Spaces:
Runtime error
Runtime error
Update templates/index.html
Browse files- templates/index.html +3 -9
templates/index.html
CHANGED
@@ -71,7 +71,7 @@
|
|
71 |
if ('webkitSpeechRecognition' in window) {
|
72 |
recognition = new webkitSpeechRecognition();
|
73 |
recognition.continuous = false;
|
74 |
-
recognition.interimResults =
|
75 |
recognition.lang = 'en-US';
|
76 |
} else {
|
77 |
alert("Speech Recognition API is not supported in this browser.");
|
@@ -86,11 +86,8 @@
|
|
86 |
function startListeningForName() {
|
87 |
document.getElementById('status').textContent = "Listening for your name...";
|
88 |
recognition.start();
|
89 |
-
let finalTranscript = "";
|
90 |
recognition.onresult = function(event) {
|
91 |
-
|
92 |
-
finalTranscript += event.results[i][0].transcript.trim();
|
93 |
-
}
|
94 |
document.getElementById('name').value = finalTranscript;
|
95 |
};
|
96 |
recognition.onend = function() {
|
@@ -101,11 +98,8 @@
|
|
101 |
function startListeningForEmail() {
|
102 |
document.getElementById('status').textContent = "Listening for your email...";
|
103 |
recognition.start();
|
104 |
-
let finalTranscript = "";
|
105 |
recognition.onresult = function(event) {
|
106 |
-
|
107 |
-
finalTranscript += event.results[i][0].transcript.trim();
|
108 |
-
}
|
109 |
finalTranscript = finalTranscript.replace(/\bat\b|\battherate\b|\bat the rate\b/gi, '@').replace(/\bdot\b/gi, '.');
|
110 |
document.getElementById('email').value = finalTranscript;
|
111 |
};
|
|
|
71 |
if ('webkitSpeechRecognition' in window) {
|
72 |
recognition = new webkitSpeechRecognition();
|
73 |
recognition.continuous = false;
|
74 |
+
recognition.interimResults = false;
|
75 |
recognition.lang = 'en-US';
|
76 |
} else {
|
77 |
alert("Speech Recognition API is not supported in this browser.");
|
|
|
86 |
function startListeningForName() {
|
87 |
document.getElementById('status').textContent = "Listening for your name...";
|
88 |
recognition.start();
|
|
|
89 |
recognition.onresult = function(event) {
|
90 |
+
let finalTranscript = event.results[event.results.length - 1][0].transcript.trim();
|
|
|
|
|
91 |
document.getElementById('name').value = finalTranscript;
|
92 |
};
|
93 |
recognition.onend = function() {
|
|
|
98 |
function startListeningForEmail() {
|
99 |
document.getElementById('status').textContent = "Listening for your email...";
|
100 |
recognition.start();
|
|
|
101 |
recognition.onresult = function(event) {
|
102 |
+
let finalTranscript = event.results[event.results.length - 1][0].transcript.trim();
|
|
|
|
|
103 |
finalTranscript = finalTranscript.replace(/\bat\b|\battherate\b|\bat the rate\b/gi, '@').replace(/\bdot\b/gi, '.');
|
104 |
document.getElementById('email').value = finalTranscript;
|
105 |
};
|