Spaces:
Running
Running
File size: 799 Bytes
7f58ee8 2794584 7f58ee8 2794584 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | // 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);
}
|