Spaces:
Runtime error
Runtime error
kelvinyasu
commited on
Commit
•
156cdff
1
Parent(s):
589d8b5
Update app.py
Browse filesModify the header and auth for protected endpoint
app.py
CHANGED
@@ -6,6 +6,7 @@ import requests
|
|
6 |
hf_token = os.getenv('HF_TOKEN')
|
7 |
api_url = os.getenv('API_URL')
|
8 |
headers = {
|
|
|
9 |
'Content-Type': 'application/json',
|
10 |
}
|
11 |
|
@@ -38,7 +39,7 @@ def predict(message, chatbot):
|
|
38 |
"temperature":0.9,}
|
39 |
}
|
40 |
|
41 |
-
response = requests.post(api_url, headers=headers, data=json.dumps(data),
|
42 |
print(response)
|
43 |
|
44 |
partial_message = ""
|
|
|
6 |
hf_token = os.getenv('HF_TOKEN')
|
7 |
api_url = os.getenv('API_URL')
|
8 |
headers = {
|
9 |
+
'Authorization': 'Bearer ' + hf_token,
|
10 |
'Content-Type': 'application/json',
|
11 |
}
|
12 |
|
|
|
39 |
"temperature":0.9,}
|
40 |
}
|
41 |
|
42 |
+
response = requests.post(api_url, headers=headers, data=json.dumps(data), stream=True)
|
43 |
print(response)
|
44 |
|
45 |
partial_message = ""
|