Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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.
|
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 |
|