Spaces:
Runtime error
Runtime error
show only non-gated models
Browse files17 unmodified lines18192021222324252627282930313233343536373817 unmodified linesconst promises = compatibleModels.map(async (model) => {const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`;const res = await fetch(configUrl, {headers: {Authorization: `Bearer ${HF_TOKEN}`}});if (!res.ok) {throw new Error(`Failed to fetch tokenizer configuration for model ${model.id}: ${res.status} ${res.statusText}`);}const tokenizerConfig = await res.json();return { ...model, tokenizerConfig } satisfies ModelEntryWithTokenizer;});const models: ModelEntryWithTokenizer[] = await Promise.all(promises);return { models };};17 unmodified lines181920212223242526272829303132333417 unmodified linesconst promises = compatibleModels.map(async (model) => {const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`;const res = await fetch(configUrl);if (!res.ok) {return null; // Ignore failed requests by returning null}const tokenizerConfig = await res.json();return { ...model, tokenizerConfig } satisfies ModelEntryWithTokenizer;});const models: ModelEntryWithTokenizer[] = (await Promise.all(promises)).filter((model) => model !== null);return { models };};
src/routes/+page.server.ts+5-9