Spaces:
Running
Running
Ali Hmaou commited on
Commit ·
ecc01e0
1
Parent(s): 8737852
Version 1.8RC
Browse files- src/mcp_server/tools.py +9 -0
src/mcp_server/tools.py
CHANGED
|
@@ -169,6 +169,15 @@ def deploy_to_space(draft_id: str, visibility: str = "public", space_target: str
|
|
| 169 |
repo_id_to_fetch = final_space_name
|
| 170 |
if "/" not in repo_id_to_fetch:
|
| 171 |
hf_user = os.environ.get("HF_USER")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
if hf_user:
|
| 173 |
repo_id_to_fetch = f"{hf_user}/{final_space_name}"
|
| 174 |
|
|
|
|
| 169 |
repo_id_to_fetch = final_space_name
|
| 170 |
if "/" not in repo_id_to_fetch:
|
| 171 |
hf_user = os.environ.get("HF_USER")
|
| 172 |
+
if not hf_user:
|
| 173 |
+
# Tentative de récupération du user via l'API si non configuré
|
| 174 |
+
try:
|
| 175 |
+
user_info = deployer.api.whoami()
|
| 176 |
+
if user_info and "name" in user_info:
|
| 177 |
+
hf_user = user_info["name"]
|
| 178 |
+
except:
|
| 179 |
+
pass
|
| 180 |
+
|
| 181 |
if hf_user:
|
| 182 |
repo_id_to_fetch = f"{hf_user}/{final_space_name}"
|
| 183 |
|