Download app-static.js from pedroivospatial/pis-spatial-intelligence-lab: direct link, hf CLI and curl.
- Browser
- Download file 3.32 kB
-
https://huggingface.co/spaces/pedroivospatial/pis-spatial-intelligence-lab/resolve/main/app-static.js
- Command line
-
hf download hf://spaces/pedroivospatial/pis-spatial-intelligence-lab/app-static.js
-
curl -L -o app-static.js https://huggingface.co/spaces/pedroivospatial/pis-spatial-intelligence-lab/resolve/main/app-static.js
3.32 kB
| const manifestState = document.querySelector("#manifest-state"); | |
| const sceneTabs = [...document.querySelectorAll(".scene-tab")]; | |
| const elements = { | |
| eyebrow: document.querySelector("#scene-eyebrow"), | |
| label: document.querySelector("#scene-label"), | |
| summary: document.querySelector("#scene-summary"), | |
| source: document.querySelector("#source-image"), | |
| depth: document.querySelector("#depth-image"), | |
| spread: document.querySelector("#metric-spread"), | |
| edge: document.querySelector("#metric-edge"), | |
| balance: document.querySelector("#metric-balance"), | |
| score: document.querySelector("#metric-score"), | |
| revision: document.querySelector("#model-revision"), | |
| }; | |
| let manifest; | |
| function setStatus(message, state) { | |
| manifestState.textContent = message; | |
| manifestState.classList.remove("is-ready", "is-error"); | |
| if (state) manifestState.classList.add(state); | |
| } | |
| function showScene(key, focus = false) { | |
| if (!manifest) return; | |
| const scene = manifest.scenes.find((candidate) => candidate.key === key); | |
| if (!scene) return; | |
| sceneTabs.forEach((tab) => { | |
| const active = tab.dataset.scene === key; | |
| tab.classList.toggle("is-active", active); | |
| tab.setAttribute("aria-selected", String(active)); | |
| tab.tabIndex = active ? 0 : -1; | |
| if (active && focus) tab.focus(); | |
| }); | |
| elements.eyebrow.textContent = scene.eyebrow; | |
| elements.label.textContent = scene.label; | |
| elements.summary.textContent = scene.summary; | |
| elements.source.src = scene.source; | |
| elements.source.alt = `Procedurally generated ${scene.label.toLowerCase()}`; | |
| elements.depth.src = scene.depth; | |
| elements.depth.alt = `Pre-computed relative-depth preview for the ${scene.label.toLowerCase()}`; | |
| elements.spread.textContent = scene.metrics.normalized_depth_spread.toFixed(3); | |
| elements.edge.textContent = scene.metrics.depth_edge_energy.toFixed(4); | |
| elements.balance.textContent = `${(scene.metrics.near_far_balance * 100).toFixed(1)}%`; | |
| elements.score.textContent = scene.metrics.demonstration_signal_score; | |
| } | |
| sceneTabs.forEach((tab, index) => { | |
| tab.addEventListener("click", () => showScene(tab.dataset.scene)); | |
| tab.addEventListener("keydown", (event) => { | |
| if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(event.key)) return; | |
| event.preventDefault(); | |
| const direction = ["ArrowRight", "ArrowDown"].includes(event.key) ? 1 : -1; | |
| const next = (index + direction + sceneTabs.length) % sceneTabs.length; | |
| showScene(sceneTabs[next].dataset.scene, true); | |
| }); | |
| }); | |
| fetch("static/results.json", { cache: "no-store" }) | |
| .then((response) => { | |
| if (!response.ok) throw new Error(`Manifest returned ${response.status}`); | |
| return response.json(); | |
| }) | |
| .then((payload) => { | |
| if ( | |
| payload.mode !== "static_precomputed_demonstration" || | |
| payload.live_inference !== false || | |
| payload.synthetic_only !== true || | |
| payload.scenes?.length !== 3 | |
| ) { | |
| throw new Error("Manifest did not pass the static safety contract"); | |
| } | |
| manifest = payload; | |
| elements.revision.textContent = payload.model.revision; | |
| setStatus("Manifest verified · 3 fixed scenes", "is-ready"); | |
| showScene("training_room"); | |
| }) | |
| .catch(() => { | |
| setStatus("Manifest unavailable · no result fabricated", "is-error"); | |
| sceneTabs.forEach((tab) => (tab.disabled = true)); | |
| }); | |