hologramicon commited on
Commit
4e49987
·
verified ·
1 Parent(s): 16324f9

Update server/src/services/hf.ts

Browse files
Files changed (1) hide show
  1. server/src/services/hf.ts +8 -6
server/src/services/hf.ts CHANGED
@@ -1,9 +1,11 @@
1
  import fetch from 'node-fetch'
2
- const KEY = process.env.HF_API_KEY
3
- const MODEL = process.env.HF_DEFAULT_MODEL || 'gpt2'
4
- const URL = `https://api-inference.huggingface.co/models/${MODEL}`
5
- export async function hfCall(url:string,payload:any){
6
- const r = await fetch(url,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)})
7
- const j:any = await r.json()
 
 
8
  return j
9
  }
 
1
  import fetch from 'node-fetch'
2
+
3
+ export async function proxyHF(url: string, payload: any) {
4
+ const r = await fetch(url, {
5
+ method: 'POST',
6
+ headers: { 'Content-Type': 'application/json' },
7
+ body: JSON.stringify(payload)
8
+ })
9
+ const j: any = await r.json()
10
  return j
11
  }