coyotte508's picture
coyotte508 HF staff
🍱 Copy folders from huggingface.js
b2ecf7d
raw
history blame
518 Bytes
import type { WidgetProps } from "$lib/components/InferenceWidget/shared/types.js";
import type { Load } from "@sveltejs/kit";
export const load: Load = async ({ params, fetch }): Promise<{ model?: WidgetProps["model"]; message?: string }> => {
const url = `https://huggingface.co/api/models/${params.model}`;
try {
const model = await (await fetch(url)).json();
return {
model,
};
} catch {
// todo: throw error() instead
return {
message: `Model ${params.model} not found (probably)`,
};
}
};