Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,9 +48,12 @@ def initialize_agent(endpoint_uri: str):
|
|
| 48 |
)
|
| 49 |
|
| 50 |
|
| 51 |
-
def wake_up_endpoint(endpoint_uri, ui, max_wait=
|
| 52 |
"""Poll the endpoint until it responds OK or timeout."""
|
| 53 |
|
|
|
|
|
|
|
|
|
|
| 54 |
# Get token from environment variable or secrets store
|
| 55 |
hf_token = os.environ.get("HF_TOKEN") # Or replace with your secret loading logic
|
| 56 |
headers = {"Authorization": f"Bearer {hf_token}"} if hf_token else {}
|
|
|
|
| 48 |
)
|
| 49 |
|
| 50 |
|
| 51 |
+
def wake_up_endpoint(endpoint_uri, ui, max_wait=300):
|
| 52 |
"""Poll the endpoint until it responds OK or timeout."""
|
| 53 |
|
| 54 |
+
|
| 55 |
+
# Enforce minimum wait time of 60 seconds
|
| 56 |
+
max_wait = max(max_wait, 60)
|
| 57 |
# Get token from environment variable or secrets store
|
| 58 |
hf_token = os.environ.get("HF_TOKEN") # Or replace with your secret loading logic
|
| 59 |
headers = {"Authorization": f"Bearer {hf_token}"} if hf_token else {}
|