Spaces:
Sleeping
Sleeping
Download static/script.js from yousbek/questionanswering: direct link, hf CLI and curl.
- Browser
- Download file 631 Bytes
-
https://huggingface.co/spaces/yousbek/questionanswering/resolve/main/static/script.js
- Command line
-
hf download hf://spaces/yousbek/questionanswering/static/script.js
-
curl -L -o script.js https://huggingface.co/spaces/yousbek/questionanswering/resolve/main/static/script.js
631 Bytes
| document.getElementById('qaForm').addEventListener('submit', async function(event) { | |
| event.preventDefault(); | |
| const formData = new FormData(); | |
| const fileInput = document.getElementById('file'); | |
| const questionInput = document.getElementById('question'); | |
| formData.append('file', fileInput.files[0]); | |
| formData.append('question', questionInput.value); | |
| const response = await fetch('/ask', { | |
| method: 'POST', | |
| body: formData | |
| }); | |
| const result = await response.json(); | |
| document.getElementById('answer').innerText = result.answer || "Erreur : " + result.detail; | |
| }); |