Spaces:
Running
Running
Tu Nombre commited on
Commit ·
d4d393b
1
Parent(s): ae729e1
fix repo_name desde respuesta HF
Browse files
main.py
CHANGED
|
@@ -118,7 +118,8 @@ async def crear_space(nicho: str, email: str) -> str:
|
|
| 118 |
print(f"Error repo: {r.text}")
|
| 119 |
return None
|
| 120 |
|
| 121 |
-
|
|
|
|
| 122 |
# Subir archivos via commit API
|
| 123 |
import base64, json as _json
|
| 124 |
def b64(s): return base64.b64encode(s.encode("utf-8")).decode("utf-8")
|
|
@@ -147,7 +148,7 @@ CMD [\"uvicorn\", \"main:app\", \"--host\", \"0.0.0.0\", \"--port\", \"7860\"]""
|
|
| 147 |
]
|
| 148 |
}
|
| 149 |
r2 = await client.post(
|
| 150 |
-
f"https://huggingface.co/api/spaces/{
|
| 151 |
headers={"Authorization": f"Bearer {token_actual}", "Content-Type": "application/json"},
|
| 152 |
content=_json.dumps(commit_payload).encode()
|
| 153 |
)
|
|
|
|
| 118 |
print(f"Error repo: {r.text}")
|
| 119 |
return None
|
| 120 |
|
| 121 |
+
repo_name = r.json().get("name", f"{hf_user_actual}/{space_id}")
|
| 122 |
+
print(f"Repo OK: {repo_name}", flush=True)
|
| 123 |
# Subir archivos via commit API
|
| 124 |
import base64, json as _json
|
| 125 |
def b64(s): return base64.b64encode(s.encode("utf-8")).decode("utf-8")
|
|
|
|
| 148 |
]
|
| 149 |
}
|
| 150 |
r2 = await client.post(
|
| 151 |
+
f"https://huggingface.co/api/spaces/{repo_name}/commit/main",
|
| 152 |
headers={"Authorization": f"Bearer {token_actual}", "Content-Type": "application/json"},
|
| 153 |
content=_json.dumps(commit_payload).encode()
|
| 154 |
)
|