prasanth345 commited on
Commit
0a2034a
·
verified ·
1 Parent(s): 6e45585

Update templates/index.html

Browse files
Files changed (1) hide show
  1. 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
- <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
7
- <title>Hotel Booking Demo</title>
8
  </head>
9
  <body>
10
- <header>
11
- <h1>Hotel Booking Demo</h1>
12
- <p>Talk to our virtual assistant for hotel bookings</p>
13
- </header>
14
- <main>
15
- <button id="voice-chat">Start Voice Chat</button>
16
- <div id="chat-container">
17
- <div id="chat-history"></div>
18
- <input type="text" id="user-input" placeholder="Type your message...">
19
- <button id="send-button">Send</button>
20
- </div>
21
- </main>
22
- <script src="{{ url_for('static', filename='script.js') }}"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>