Spaces:
Running
Running
Update templates/menu_page.html
Browse files- templates/menu_page.html +2 -34
templates/menu_page.html
CHANGED
@@ -73,41 +73,9 @@
|
|
73 |
});
|
74 |
}
|
75 |
|
76 |
-
//
|
77 |
-
|
78 |
-
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
79 |
-
recognition.lang = 'en-US';
|
80 |
-
recognition.interimResults = false;
|
81 |
|
82 |
-
recognition.onresult = (event) => {
|
83 |
-
const command = event.results[0][0].transcript.toLowerCase();
|
84 |
-
if (command.includes('veg')) {
|
85 |
-
showMenu('veg');
|
86 |
-
speak('Here are the Veg items.');
|
87 |
-
} else if (command.includes('non-veg')) {
|
88 |
-
showMenu('non-veg');
|
89 |
-
speak('Here are the Non-Veg items.');
|
90 |
-
} else {
|
91 |
-
speak('Please say Veg or Non-Veg to choose the menu.');
|
92 |
-
recognition.start();
|
93 |
-
}
|
94 |
-
};
|
95 |
-
|
96 |
-
recognition.onerror = () => { speak('Sorry, I could not understand. Please try again.'); };
|
97 |
-
|
98 |
-
speak('Would you like to see the Veg or Non-Veg menu?', () => {
|
99 |
-
recognition.start();
|
100 |
-
});
|
101 |
-
}
|
102 |
-
|
103 |
-
// Speech synthesis function
|
104 |
-
function speak(text, callback) {
|
105 |
-
const msg = new SpeechSynthesisUtterance(text);
|
106 |
-
msg.onend = callback;
|
107 |
-
window.speechSynthesis.speak(msg);
|
108 |
-
}
|
109 |
-
|
110 |
-
window.onload = askForMenuChoice; // Automatically ask for menu choice when page loads
|
111 |
</script>
|
112 |
</body>
|
113 |
</html>
|
|
|
73 |
});
|
74 |
}
|
75 |
|
76 |
+
// Initially load Veg items automatically
|
77 |
+
showMenu('veg');
|
|
|
|
|
|
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
</script>
|
80 |
</body>
|
81 |
</html>
|