Spaces:
Sleeping
Sleeping
Update templates/wakeup.html
Browse files- templates/wakeup.html +41 -0
templates/wakeup.html
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Voice Wake Word</title>
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<h1>Say "Hi Biriyani Hub" to Activate</h1>
|
| 10 |
+
<script>
|
| 11 |
+
// Check if SpeechRecognition is supported
|
| 12 |
+
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
| 13 |
+
if (!window.SpeechRecognition) {
|
| 14 |
+
alert("Your browser does not support Speech Recognition. Please use Chrome.");
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const recognition = new SpeechRecognition();
|
| 18 |
+
recognition.continuous = true; // Keep listening
|
| 19 |
+
recognition.lang = "en-US";
|
| 20 |
+
|
| 21 |
+
// Start listening for the wake word
|
| 22 |
+
recognition.start();
|
| 23 |
+
|
| 24 |
+
recognition.onresult = function(event) {
|
| 25 |
+
let transcript = event.results[event.results.length - 1][0].transcript.toLowerCase();
|
| 26 |
+
console.log("You said:", transcript);
|
| 27 |
+
|
| 28 |
+
if (transcript.includes("hi biriyani hub")) {
|
| 29 |
+
console.log("Wake word detected! Redirecting...");
|
| 30 |
+
|
| 31 |
+
// Redirect to the landing page
|
| 32 |
+
window.location.href = "/landing";
|
| 33 |
+
}
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
recognition.onerror = function(event) {
|
| 37 |
+
console.error("Speech recognition error:", event.error);
|
| 38 |
+
};
|
| 39 |
+
</script>
|
| 40 |
+
</body>
|
| 41 |
+
</html>
|