Spaces:
No application file
No application file
File size: 1,052 Bytes
308500d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
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}`;
}
|