ybelkada commited on
Commit
822e468
·
1 Parent(s): 8aa7c89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -1,11 +1,17 @@
 
 
1
  import gradio as gr
2
  import requests
3
 
 
 
4
  UL2_API_URL = "https://api-inference.huggingface.co/models/google/flan-ul2"
5
  FLAN_API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-xxl"
6
 
 
 
7
  def query(payload, api_url):
8
- response = requests.request("POST", api_url, json={"inputs":payload})
9
  return response.json()
10
 
11
 
 
1
+ import os
2
+
3
  import gradio as gr
4
  import requests
5
 
6
+ TOKEN = os.environ.get("API_TOKEN")
7
+
8
  UL2_API_URL = "https://api-inference.huggingface.co/models/google/flan-ul2"
9
  FLAN_API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-xxl"
10
 
11
+ headers = {"Authorization": f"Bearer {TOKEN}"}
12
+
13
  def query(payload, api_url):
14
+ response = requests.post(api_url, headers=headers, json={"inputs":payload})
15
  return response.json()
16
 
17