Spaces:
No application file
No application file
Download static/script.js from foreversheikh/anomaly_dector: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/spaces/foreversheikh/anomaly_dector/resolve/main/static/script.js
- Command line
-
hf download hf://spaces/foreversheikh/anomaly_dector/static/script.js
-
curl -L -o script.js https://huggingface.co/spaces/foreversheikh/anomaly_dector/resolve/main/static/script.js
1.05 kB
| const videoPlayer = document.getElementById("videoPlayer"); | |
| const yoloResult = document.getElementById("yoloResult"); | |
| // Dummy chart for anomaly graph | |
| const ctx = document.getElementById("anomalyGraph").getContext("2d"); | |
| const graph = new Chart(ctx, { | |
| type: "line", | |
| data: { | |
| labels: [], | |
| datasets: [{ | |
| label: "Anomaly Score", | |
| data: [], | |
| borderColor: "red", | |
| borderWidth: 2 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| scales: { | |
| y: { min: 0, max: 1 } | |
| } | |
| } | |
| }); | |
| async function playDemo(name) { | |
| const response = await fetch("/get_video", { | |
| method: "POST", | |
| headers: {"Content-Type": "application/json"}, | |
| body: JSON.stringify({ name }) | |
| }); | |
| const data = await response.json(); | |
| if (data.error) { | |
| alert(data.error); | |
| return; | |
| } | |
| // Load video | |
| videoPlayer.src = "file:///" + data.path; | |
| yoloResult.innerText = `Playing demo: ${name}`; | |
| } | |