// 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); }