Spaces:
Runtime error
Runtime error
nivashuggingface
commited on
Commit
•
5cd3519
1
Parent(s):
27cad67
Update app.py
Browse files
app.py
CHANGED
@@ -7,12 +7,14 @@ from PIL import Image
|
|
7 |
import base64
|
8 |
import os
|
9 |
import requests
|
|
|
10 |
|
11 |
# Load Hugging Face token from environment variable
|
12 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
13 |
if not HF_TOKEN:
|
14 |
raise ValueError("Hugging Face token not found in environment variables.")
|
15 |
|
|
|
16 |
def get_dynamic_endpoint():
|
17 |
"""
|
18 |
Fetch the dynamic endpoint using the Hugging Face API.
|
|
|
7 |
import base64
|
8 |
import os
|
9 |
import requests
|
10 |
+
from tenacity import retry, wait_exponential, stop_after_attempt
|
11 |
|
12 |
# Load Hugging Face token from environment variable
|
13 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
14 |
if not HF_TOKEN:
|
15 |
raise ValueError("Hugging Face token not found in environment variables.")
|
16 |
|
17 |
+
@retry(wait=wait_exponential(multiplier=1, min=4, max=10), stop=stop_after_attempt(5))
|
18 |
def get_dynamic_endpoint():
|
19 |
"""
|
20 |
Fetch the dynamic endpoint using the Hugging Face API.
|