VethaNarayananG commited on
Commit
b502e0a
·
verified ·
1 Parent(s): b5883f6

Create models.js

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