Download static/chat.html from rohangbs/Test: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/spaces/rohangbs/Test/resolve/main/static/chat.html
- Command line
-
hf download hf://spaces/rohangbs/Test/static/chat.html
-
curl -L -o chat.html https://huggingface.co/spaces/rohangbs/Test/resolve/main/static/chat.html
1.51 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Chat with Amara</title> | |
| <style> | |
| body { font-family: Arial, sans-serif; } | |
| #chat-box { border: 1px solid #ccc; padding: 10px; margin: 20px; height: 400px; overflow-y: scroll; } | |
| #user-input { margin: 20px; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Chat with Amara</h1> | |
| <div id="chat-box"></div> | |
| <div id="user-input"> | |
| <input type="text" id="message" placeholder="Type your message here..." /> | |
| <button onclick="sendMessage()">Send</button> | |
| </div> | |
| <script> | |
| async function sendMessage() { | |
| const messageInput = document.getElementById('message'); | |
| const message = messageInput.value; | |
| messageInput.value = ''; | |
| // Display the user's message | |
| addMessage(`You: ${message}`); | |
| // Send the message to the chatbot | |
| const response = await fetch('/chat', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| }, | |
| body: JSON.stringify({ message }) | |
| }); | |
| const data = await response.json(); | |
| addMessage(`Amara: ${data.response}`); | |
| } | |
| function addMessage(message) { | |
| const chatBox = document.getElementById('chat-box'); | |
| chatBox.innerHTML += `<div>${message}</div>`; | |
| chatBox.scrollTop = chatBox.scrollHeight; // Scroll to the bottom | |
| } | |
| </script> | |
| </body> | |
| </html> | |