Download index.html from AleRive/chat: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/AleRive/chat/resolve/main/index.html
- Command line
-
hf download hf://spaces/AleRive/chat/index.html
-
curl -L -o index.html https://huggingface.co/spaces/AleRive/chat/resolve/main/index.html
1.29 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Chat Teuken</title> | |
| <style> | |
| body { font-family: Arial, sans-serif; margin: 20px; } | |
| #chatbox { border: 1px solid #ccc; padding: 10px; width: 300px; height: 400px; overflow-y: scroll; } | |
| #input { margin-top: 10px; width: 300px; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>ChatBot</h1> | |
| <div id="chatbox"></div> | |
| <input id="input" type="text" placeholder="Scrivi un messaggio..."> | |
| <button onclick="sendMessage()">Invia</button> | |
| <script> | |
| async function sendMessage() { | |
| const inputField = document.getElementById('input'); | |
| const message = inputField.value; | |
| inputField.value = ''; | |
| const chatbox = document.getElementById('chatbox'); | |
| chatbox.innerHTML += `<div>Tu: ${message}</div>`; | |
| const response = await fetch('/chat', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ prompt: message }) | |
| }); | |
| const data = await response.json(); | |
| chatbox.innerHTML += `<div>BOT: ${data.response}</div>`; | |
| chatbox.scrollTop = chatbox.scrollHeight; | |
| } | |
| </script> | |
| </body> | |
| </html> | |