File size: 449 Bytes
b502e0a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | async function queryHF(model, prompt){
const response = await fetch(
`https://api-inference.huggingface.co/models/${model}`,
{
method:"POST",
headers:{
"Authorization":"Bearer "+HF_TOKEN,
"Content-Type":"application/json"
},
body:JSON.stringify({
inputs:prompt
})
}
);
return await response.json();
} |