Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
1719ec5
1
Parent(s): c45ebae
fix: use OAuth token for sandbox creation instead of env HF_TOKEN
Browse files
agent/tools/sandbox_tool.py
CHANGED
|
@@ -38,9 +38,13 @@ async def _ensure_sandbox(
|
|
| 38 |
if not session:
|
| 39 |
return None, "No session available."
|
| 40 |
|
| 41 |
-
token =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
if not token:
|
| 43 |
-
return None, "
|
| 44 |
|
| 45 |
api = HfApi(token=token)
|
| 46 |
user_info = api.whoami()
|
|
|
|
| 38 |
if not session:
|
| 39 |
return None, "No session available."
|
| 40 |
|
| 41 |
+
token = (
|
| 42 |
+
getattr(session, "hf_token", None)
|
| 43 |
+
or os.environ.get("HF_TOKEN")
|
| 44 |
+
or os.environ.get("HUGGINGFACE_HUB_TOKEN")
|
| 45 |
+
)
|
| 46 |
if not token:
|
| 47 |
+
return None, "No HF token available. Cannot create sandbox."
|
| 48 |
|
| 49 |
api = HfApi(token=token)
|
| 50 |
user_info = api.whoami()
|