Spaces:
Running
Running
Download commit.js from Battam/training-data-foundation: direct link, hf CLI and curl.
- Browser
- Download file 933 Bytes
-
https://huggingface.co/spaces/Battam/training-data-foundation/resolve/main/commit.js
- Command line
-
hf download hf://spaces/Battam/training-data-foundation/commit.js
-
curl -L -o commit.js https://huggingface.co/spaces/Battam/training-data-foundation/resolve/main/commit.js
933 Bytes
| // The commit of the dataset the page reads: asked of the Hub once and shared by the first screen (first.js) and the | |
| // reader of the index (data.js), so both name the same commit. | |
| import { datasetInfo } from 'https://cdn.jsdelivr.net/npm/@huggingface/hub@2.17.10/+esm'; | |
| export const REPO = 'Battam/training-data-foundation'; | |
| export const HF = 'https://huggingface.co'; | |
| const asked = new Map(); | |
| /** The commit to read: ?rev=<sha or branch>, else main. -> {sha, date, files}; sha is '' when the Hub gave none. */ | |
| export function loadRevision(rev) { | |
| const key = rev || 'main'; | |
| if (!asked.has(key)) { | |
| asked.set(key, datasetInfo({ name: REPO, revision: key, additionalFields: ['sha', 'siblings'] }).then((j) => { | |
| const sha = /^[0-9a-f]{40}$/.test(j.sha || '') ? j.sha : ''; | |
| return { sha, date: j.updatedAt.toISOString(), files: (j.siblings || []).map((s) => s.rfilename) }; | |
| })); | |
| } | |
| return asked.get(key); | |
| } | |