| 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(); | |
| } |