Spaces:
Running
Running
Download script.js from sreepathi-ravikumar/rpu: direct link, hf CLI and curl.
- Browser
- Download file 650 Bytes
-
https://huggingface.co/spaces/sreepathi-ravikumar/rpu/resolve/main/script.js
- Command line
-
hf download hf://spaces/sreepathi-ravikumar/rpu/script.js
-
curl -L -o script.js https://huggingface.co/spaces/sreepathi-ravikumar/rpu/resolve/main/script.js
650 Bytes
| function askAI() { | |
| const question = document.getElementById("userInput").value; | |
| const responseBox = document.getElementById("response"); | |
| // Clear previous response and show loading... | |
| responseBox.innerText = "Thinking... 🤔"; | |
| if (question.trim() === "") { | |
| responseBox.innerText = "Please enter a question."; | |
| return; | |
| } | |
| // Ask the question to the AI | |
| puter.ai.chat(question) | |
| .then(response => { | |
| responseBox.innerText = response; | |
| }) | |
| .catch(error => { | |
| responseBox.innerText = "Oops! Something went wrong."; | |
| console.error(error); | |
| }); | |
| } |