Download validation_playback.html from spsarolkar/SignLanguageTranslate: direct link, hf CLI and curl.
- Browser
- Download file 2.94 kB
-
https://huggingface.co/spaces/spsarolkar/SignLanguageTranslate/resolve/main/validation_playback.html
- Command line
-
hf download hf://spaces/spsarolkar/SignLanguageTranslate/validation_playback.html
-
curl -L -o validation_playback.html https://huggingface.co/spaces/spsarolkar/SignLanguageTranslate/resolve/main/validation_playback.html
2.94 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <style> | |
| body { margin: 0; font: 15px system-ui, sans-serif; color: #17212d; background: #fff; } | |
| video { display: block; width: 100%; max-height: 248px; background: #111; border-radius: 8px; } | |
| label { display: block; margin: 8px 0; } | |
| input { width: calc(100% - 4px); margin: 0; } | |
| #predictions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; } | |
| article { border: 1px solid #bbc4cf; border-radius: 8px; padding: 10px; } | |
| h2 { font-size: 14px; margin: 0 0 6px; } | |
| p { margin: 4px 0; } | |
| @media (prefers-color-scheme: dark) { | |
| body { color: #e5e7eb; background: #111827; } | |
| article { border-color: #667185; } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <video id="video" controls preload="none" playsinline hidden></video> | |
| <p id="status" role="status"></p> | |
| <label for="position">Playback time <output id="seconds" for="position">0.00 s</output></label> | |
| <input type="range" id="position" min="0" step="0.01"> | |
| <section id="predictions" aria-label="Model predictions"></section> | |
| <script> | |
| const data = /* PAYLOAD */; | |
| const video = document.getElementById("video"); | |
| const slider = document.getElementById("position"); | |
| const status = document.getElementById("status"); | |
| const seconds = document.getElementById("seconds"); | |
| const cards = {}; | |
| slider.max = data.duration; | |
| if (data.video) { | |
| video.hidden = false; | |
| video.src = data.video; | |
| video.addEventListener("error", () => { | |
| status.textContent = "This browser could not play the source video. You can still use the timeline slider."; | |
| }); | |
| } | |
| for (const [arm, name] of Object.entries(data.arms)) { | |
| const card = document.createElement("article"); | |
| const title = document.createElement("h2"); | |
| title.textContent = name; | |
| const guess = document.createElement("p"); | |
| const confirmed = document.createElement("p"); | |
| card.append(title, guess, confirmed); | |
| document.getElementById("predictions").append(card); | |
| cards[arm] = {guess, confirmed}; | |
| } | |
| function update(time) { | |
| slider.value = time; | |
| seconds.textContent = time.toFixed(2) + " s"; | |
| for (const [arm, {guess, confirmed}] of Object.entries(cards)) { | |
| const result = data.predictions[arm]; | |
| let last; | |
| for (const tick of result.ticks) { | |
| if (tick.time > time) break; | |
| last = tick; | |
| } | |
| guess.textContent = "Current guess: " + (last?.label ?? "—"); | |
| confirmed.textContent = "Confirmed: " + ( | |
| result.early && result.early.time <= time | |
| ? result.early.label + " at " + result.early.time.toFixed(2) + " s" | |
| : "—" | |
| ); | |
| } | |
| } | |
| slider.addEventListener("input", () => { | |
| const time = Number(slider.value); | |
| if (data.video && video.readyState >= 1) video.currentTime = time; | |
| update(time); | |
| }); | |
| video.addEventListener("timeupdate", () => update(video.currentTime)); | |
| update(0); | |
| </script> | |
| </body> | |
| </html> | |