VethaNarayananG's picture
Create models.js
b502e0a verified
Raw
History Blame Contribute Delete
449 Bytes
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();
}