Spaces:
Runtime error
Runtime error
Update templates/index.html
Browse files- templates/index.html +47 -15
templates/index.html
CHANGED
@@ -3,22 +3,54 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<
|
7 |
-
<
|
8 |
</head>
|
9 |
<body>
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<
|
16 |
-
<
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
</body>
|
24 |
</html>
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Hotel Booking AI</title>
|
7 |
+
<link rel="stylesheet" href="/static/style.css">
|
8 |
</head>
|
9 |
<body>
|
10 |
+
|
11 |
+
<h1>Welcome to Hotel Booking AI</h1>
|
12 |
+
|
13 |
+
<div id="chatbot-container">
|
14 |
+
<h2>Chat with our AI</h2>
|
15 |
+
<div id="chat-history"></div>
|
16 |
+
<input type="text" id="user-input" placeholder="Type your message...">
|
17 |
+
<button onclick="sendMessage()">Send</button>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<div id="voice-container">
|
21 |
+
<h2>Voice Interaction</h2>
|
22 |
+
<div id="voice-response"></div>
|
23 |
+
<input type="file" accept="audio/*" id="voice-input" onchange="sendVoice()">
|
24 |
+
<button onclick="sendVoice()">Send Voice</button>
|
25 |
+
</div>
|
26 |
+
|
27 |
+
<script>
|
28 |
+
// JavaScript for chat functionality
|
29 |
+
function sendMessage() {
|
30 |
+
var input = document.getElementById('user-input').value;
|
31 |
+
fetch('/chatbot', {
|
32 |
+
method: 'POST',
|
33 |
+
headers: { 'Content-Type': 'application/json' },
|
34 |
+
body: JSON.stringify({ message: input })
|
35 |
+
})
|
36 |
+
.then(response => response.text())
|
37 |
+
.then(data => document.getElementById('chat-history').innerHTML += `<p>User: ${input}</p><p>AI: ${data}</p>`);
|
38 |
+
}
|
39 |
+
|
40 |
+
// JavaScript for voice functionality
|
41 |
+
function sendVoice() {
|
42 |
+
var audioInput = document.getElementById('voice-input').files[0];
|
43 |
+
var formData = new FormData();
|
44 |
+
formData.append('audio', audioInput);
|
45 |
+
|
46 |
+
fetch('/voice', {
|
47 |
+
method: 'POST',
|
48 |
+
body: formData
|
49 |
+
})
|
50 |
+
.then(response => response.text())
|
51 |
+
.then(data => document.getElementById('voice-response').innerHTML = `<p>${data}</p>`);
|
52 |
+
}
|
53 |
+
</script>
|
54 |
+
|
55 |
</body>
|
56 |
</html>
|