Spaces:
Running
Running
Download js/data.js from Chennzi/agentic-forecasting: direct link, hf CLI and curl.
- Browser
- Download file 799 Bytes
-
https://huggingface.co/spaces/Chennzi/agentic-forecasting/resolve/main/js/data.js
- Command line
-
hf download hf://spaces/Chennzi/agentic-forecasting/js/data.js
-
curl -L -o data.js https://huggingface.co/spaces/Chennzi/agentic-forecasting/resolve/main/js/data.js
799 Bytes
| // Every page reads static JSON from /site next to the pages: runs/site when previewed locally | |
| // (python -m af serve), the Space's own site/ when deployed. Downloads link to the results | |
| // dataset, which asks visitors to request access. | |
| import { RESULTS } from "./config.js"; | |
| const HF = `https://huggingface.co/datasets/${RESULTS}`; | |
| const BASE = "/site"; | |
| export const fileUrl = (path) => `${HF}/resolve/main/${path}`; | |
| export const treeUrl = (path) => `${HF}/tree/main/${path}`; | |
| const cache = new Map(); | |
| export function load(path) { | |
| if (!cache.has(path)) { | |
| cache.set(path, fetch(`${BASE}/${path}`, { cache: "no-cache" }).then((response) => { | |
| if (!response.ok) throw new Error(`${path}: HTTP ${response.status}`); | |
| return response.json(); | |
| })); | |
| } | |
| return cache.get(path); | |
| } | |