Spaces:
Runtime error
Runtime error
Create templates/index.html
Browse files- templates/index.html +132 -0
templates/index.html
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Biryani Hub Registration</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
| 8 |
+
<style>
|
| 9 |
+
body {
|
| 10 |
+
font-family: 'Roboto', sans-serif;
|
| 11 |
+
background: linear-gradient(135deg, #f4c542, #ff8f6a);
|
| 12 |
+
margin: 0;
|
| 13 |
+
display: flex;
|
| 14 |
+
justify-content: center;
|
| 15 |
+
align-items: center;
|
| 16 |
+
height: 100vh;
|
| 17 |
+
text-align: center;
|
| 18 |
+
}
|
| 19 |
+
.container {
|
| 20 |
+
background: lightblue;
|
| 21 |
+
padding: 40px 50px;
|
| 22 |
+
border-radius: 10px;
|
| 23 |
+
width: 400px;
|
| 24 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
| 25 |
+
}
|
| 26 |
+
h1 {
|
| 27 |
+
font-size: 30px;
|
| 28 |
+
font-weight: bold;
|
| 29 |
+
color: #ff6a00;
|
| 30 |
+
}
|
| 31 |
+
label {
|
| 32 |
+
font-size: 18px;
|
| 33 |
+
margin-top: 20px;
|
| 34 |
+
display: block;
|
| 35 |
+
text-align: left;
|
| 36 |
+
}
|
| 37 |
+
input[type="text"] {
|
| 38 |
+
width: 100%;
|
| 39 |
+
padding: 10px;
|
| 40 |
+
font-size: 16px;
|
| 41 |
+
border: 1px solid #ccc;
|
| 42 |
+
border-radius: 5px;
|
| 43 |
+
margin-top: 8px;
|
| 44 |
+
}
|
| 45 |
+
.info {
|
| 46 |
+
margin-top: 20px;
|
| 47 |
+
font-size: 16px;
|
| 48 |
+
color: #ff6a00;
|
| 49 |
+
font-weight: bold;
|
| 50 |
+
}
|
| 51 |
+
.status {
|
| 52 |
+
font-size: 14px;
|
| 53 |
+
color: gray;
|
| 54 |
+
margin-top: 20px;
|
| 55 |
+
}
|
| 56 |
+
</style>
|
| 57 |
+
</head>
|
| 58 |
+
<body>
|
| 59 |
+
<div class="container">
|
| 60 |
+
<h1>Welcome to Biryani Hub</h1>
|
| 61 |
+
|
| 62 |
+
<label for="name">Your Name</label>
|
| 63 |
+
<input type="text" id="name" placeholder="Your name will appear here..." readonly>
|
| 64 |
+
|
| 65 |
+
<label for="email">Your Email</label>
|
| 66 |
+
<input type="text" id="email" placeholder="Your email will appear here..." readonly>
|
| 67 |
+
|
| 68 |
+
<p class="info" id="infoMessage">Listening will start automatically...</p>
|
| 69 |
+
<p class="status" id="status">Initializing...</p>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<script>
|
| 73 |
+
let recognition;
|
| 74 |
+
let nameCaptured = "";
|
| 75 |
+
let emailCaptured = "";
|
| 76 |
+
if ('webkitSpeechRecognition' in window) {
|
| 77 |
+
recognition = new webkitSpeechRecognition();
|
| 78 |
+
recognition.continuous = false;
|
| 79 |
+
recognition.interimResults = false;
|
| 80 |
+
recognition.lang = 'en-US';
|
| 81 |
+
} else {
|
| 82 |
+
alert("Speech Recognition API is not supported in this browser.");
|
| 83 |
+
}
|
| 84 |
+
function speak(text, callback) {
|
| 85 |
+
const speech = new SpeechSynthesisUtterance(text);
|
| 86 |
+
speech.onend = callback;
|
| 87 |
+
window.speechSynthesis.speak(speech);
|
| 88 |
+
}
|
| 89 |
+
function startListeningForName() {
|
| 90 |
+
recognition.start();
|
| 91 |
+
recognition.onresult = function(event) {
|
| 92 |
+
nameCaptured = event.results[0][0].transcript.trim();
|
| 93 |
+
document.getElementById('name').value = nameCaptured;
|
| 94 |
+
recognition.stop();
|
| 95 |
+
setTimeout(confirmName, 500);
|
| 96 |
+
};
|
| 97 |
+
}
|
| 98 |
+
function confirmName() {
|
| 99 |
+
speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
|
| 100 |
+
recognition.start();
|
| 101 |
+
recognition.onresult = function(event) {
|
| 102 |
+
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
| 103 |
+
recognition.stop();
|
| 104 |
+
if (confirmation.includes("ok") || confirmation.includes("yes")) {
|
| 105 |
+
setTimeout(() => speak("Great! Now, tell me your email.", startListeningForEmail), 500);
|
| 106 |
+
} else {
|
| 107 |
+
setTimeout(() => speak("Let's try again. Tell me your name.", startListeningForName), 500);
|
| 108 |
+
}
|
| 109 |
+
};
|
| 110 |
+
});
|
| 111 |
+
}
|
| 112 |
+
function startListeningForEmail() {
|
| 113 |
+
recognition.start();
|
| 114 |
+
recognition.onresult = function(event) {
|
| 115 |
+
emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
| 116 |
+
document.getElementById('email').value = emailCaptured;
|
| 117 |
+
recognition.stop();
|
| 118 |
+
speak("Your registration is complete. Thank you for registering.");
|
| 119 |
+
setTimeout(() => location.reload(), 20000);
|
| 120 |
+
};
|
| 121 |
+
}
|
| 122 |
+
function startProcess() {
|
| 123 |
+
speak("Welcome to Biryani Hub", function() {
|
| 124 |
+
speak("Tell me your name, and I will confirm it with you.", startListeningForName);
|
| 125 |
+
});
|
| 126 |
+
}
|
| 127 |
+
window.onload = function () {
|
| 128 |
+
setTimeout(startProcess, 4000);
|
| 129 |
+
};
|
| 130 |
+
</script>
|
| 131 |
+
</body>
|
| 132 |
+
</html>
|