Spaces:
Runtime error
Runtime error
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Hotel Booking AI</title> | |
<link rel="stylesheet" href="/static/style.css"> | |
</head> | |
<body> | |
<h1>Welcome to Hotel Booking AI</h1> | |
<div id="chatbot-container"> | |
<h2>Chat with our AI</h2> | |
<div id="chat-history"></div> | |
<input type="text" id="user-input" placeholder="Type your message..."> | |
<button onclick="sendMessage()">Send</button> | |
</div> | |
<div id="voice-container"> | |
<h2>Voice Interaction</h2> | |
<div id="voice-response"></div> | |
<input type="file" accept="audio/*" id="voice-input" onchange="sendVoice()"> | |
<button onclick="sendVoice()">Send Voice</button> | |
</div> | |
<script> | |
// JavaScript for chat functionality | |
function sendMessage() { | |
var input = document.getElementById('user-input').value; | |
fetch('/chatbot', { | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify({ message: input }) | |
}) | |
.then(response => response.text()) | |
.then(data => document.getElementById('chat-history').innerHTML += `<p>User: ${input}</p><p>AI: ${data}</p>`); | |
} | |
// JavaScript for voice functionality | |
function sendVoice() { | |
var audioInput = document.getElementById('voice-input').files[0]; | |
var formData = new FormData(); | |
formData.append('audio', audioInput); | |
fetch('/voice', { | |
method: 'POST', | |
body: formData | |
}) | |
.then(response => response.text()) | |
.then(data => document.getElementById('voice-response').innerHTML = `<p>${data}</p>`); | |
} | |
</script> | |
</body> | |
</html> | |