Spaces:
Runtime error
Runtime error
Adding auth to not get rate limited.
Browse files
app.py
CHANGED
@@ -12,11 +12,12 @@ from screenshot import (
|
|
12 |
from spaces_info import description, examples, initial_prompt_value
|
13 |
|
14 |
API_URL = os.getenv("API_URL")
|
|
|
15 |
|
16 |
|
17 |
def query(payload):
|
18 |
print(payload)
|
19 |
-
response = requests.request("POST", API_URL, json=payload)
|
20 |
print(response)
|
21 |
return json.loads(response.content.decode("utf-8"))
|
22 |
|
|
|
12 |
from spaces_info import description, examples, initial_prompt_value
|
13 |
|
14 |
API_URL = os.getenv("API_URL")
|
15 |
+
HF_API_TOKEN = os.getenv("HF_API_TOKEN")
|
16 |
|
17 |
|
18 |
def query(payload):
|
19 |
print(payload)
|
20 |
+
response = requests.request("POST", API_URL, json=payload, headers={"Authorization": f"Bearer {HF_API_TOKEN}"})
|
21 |
print(response)
|
22 |
return json.loads(response.content.decode("utf-8"))
|
23 |
|