Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,6 +47,11 @@ def initialize_agent(endpoint_uri: str):
|
|
| 47 |
|
| 48 |
def wake_up_endpoint(endpoint_uri, max_wait=30):
|
| 49 |
"""Poll the endpoint until it responds OK or timeout."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
payload = {"inputs": "ping"} # Adjust to minimal valid input
|
| 51 |
start = time.time()
|
| 52 |
|
|
|
|
| 47 |
|
| 48 |
def wake_up_endpoint(endpoint_uri, max_wait=30):
|
| 49 |
"""Poll the endpoint until it responds OK or timeout."""
|
| 50 |
+
|
| 51 |
+
# Get token from environment variable or secrets store
|
| 52 |
+
hf_token = os.environ.get("HF_TOKEN") # Or replace with your secret loading logic
|
| 53 |
+
headers = {"Authorization": f"Bearer {hf_token}"} if hf_token else {}
|
| 54 |
+
|
| 55 |
payload = {"inputs": "ping"} # Adjust to minimal valid input
|
| 56 |
start = time.time()
|
| 57 |
|