Spaces:
Runtime error
Runtime error
Download static/script.js from Soltane777/AIProject: direct link, hf CLI and curl.
- Browser
- Download file 590 Bytes
-
https://huggingface.co/spaces/Soltane777/AIProject/resolve/main/static/script.js
- Command line
-
hf download hf://spaces/Soltane777/AIProject/static/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Soltane777/AIProject/resolve/main/static/script.js
590 Bytes
| document.getElementById("upload-form").addEventListener("submit", async (e) => { | |
| e.preventDefault(); | |
| const fileInput = document.getElementById("file-input"); | |
| const formData = new FormData(); | |
| formData.append("file", fileInput.files[0]); | |
| const endpoint = fileInput.files[0].type.startsWith("image/") ? "/caption" : "/summarize"; | |
| const response = await fetch(endpoint, { | |
| method: "POST", | |
| body: formData | |
| }); | |
| const result = await response.json(); | |
| document.getElementById("result").innerText = result.summary || result.caption; | |
| }); |