Spaces:
Runtime error
Runtime error
Download static/script.js from alaajabari/wojood-api: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/alaajabari/wojood-api/resolve/main/static/script.js
- Command line
-
hf download hf://spaces/alaajabari/wojood-api/static/script.js
-
curl -L -o script.js https://huggingface.co/spaces/alaajabari/wojood-api/resolve/main/static/script.js
1.15 kB
| async function runNER() { | |
| const text = document.getElementById("text").value; | |
| const mode = document.getElementById("mode").value; | |
| const status = document.getElementById("status"); | |
| const button = document.getElementById("extractBtn"); | |
| const output = document.getElementById("output"); | |
| // Show processing message | |
| status.textContent = "⏳ Extracting entities..."; | |
| status.style.color = "blue"; | |
| button.disabled = true; | |
| try { | |
| const response = await fetch("/predict", { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json" | |
| }, | |
| body: JSON.stringify({ text, mode }) | |
| }); | |
| const data = await response.json(); | |
| output.textContent = JSON.stringify(data, null, 2); | |
| // Finished successfully | |
| status.textContent = "✅ Extraction completed."; | |
| status.style.color = "green"; | |
| } catch (error) { | |
| output.textContent = error; | |
| status.textContent = "❌ An error occurred during extraction."; | |
| status.style.color = "red"; | |
| } finally { | |
| button.disabled = false; | |
| } | |
| } |