File size: 489 Bytes
7c447a5
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
// 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();
}