Spaces:
No application file
No application file
Download index.html from Mashbox41/Droidchatts: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/Mashbox41/Droidchatts/resolve/main/index.html
- Command line
-
hf download hf://spaces/Mashbox41/Droidchatts/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Mashbox41/Droidchatts/resolve/main/index.html
1.26 kB
| <html> | |
| <head><meta name="viewport" content="width=device-width, initial-scale=1"><title>Droidchatts</title></head> | |
| <body> | |
| <h1>Droid Chat + TTS</h1> | |
| <textarea id="chat" placeholder="Say something..."></textarea><br> | |
| <button onclick="sendChat()">Send Chat</button><br> | |
| <p id="reply"></p> | |
| <textarea id="speak" placeholder="Text to speak..."></textarea><br> | |
| <button onclick="sendTTS()">Speak</button><br> | |
| <audio id="audio" controls></audio> | |
| <script> | |
| async function sendChat() { | |
| const text = document.getElementById("chat").value; | |
| const res = await fetch("/chat", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ prompt: text }) | |
| }); | |
| const data = await res.json(); | |
| document.getElementById("reply").innerText = data.response; | |
| } | |
| async function sendTTS() { | |
| const text = document.getElementById("speak").value; | |
| const res = await fetch("/tts", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ text }) | |
| }); | |
| const blob = await res.blob(); | |
| document.getElementById("audio").src = URL.createObjectURL(blob); | |
| } | |
| </script> | |
| </body> | |
| </html> |