peihsin0715
Add all project files for HF Spaces deployment
7c447a5
raw
history blame contribute delete
489 Bytes
// src/services/hf.ts
export async function fetchHFModel(modelId: string) {
const r = await fetch(`https://huggingface.co/api/models/${modelId}`);
if (!r.ok) throw new Error('The model does not exist or cannot be accessed');
return r.json();
}
export async function fetchHFDataset(datasetId: string) {
const r = await fetch(`https://huggingface.co/api/datasets/${datasetId}`);
if (!r.ok) throw new Error('The dataset does not exist or cannot be accessed');
return r.json();
}