Spaces:
Paused
Paused
Download force_deploy.py from jynxzio5/onlinefix-api: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/jynxzio5/onlinefix-api/resolve/main/force_deploy.py
- Command line
-
hf download hf://spaces/jynxzio5/onlinefix-api/force_deploy.py
-
curl -L -o force_deploy.py https://huggingface.co/spaces/jynxzio5/onlinefix-api/resolve/main/force_deploy.py
1.14 kB
| import os | |
| from huggingface_hub import HfApi | |
| api = HfApi() | |
| repo_id = "jynxzio5/onlinefix-api" | |
| script_dir = os.path.dirname(os.path.abspath(__file__)) | |
| print("Uploading server.js directly...") | |
| api.upload_file( | |
| path_or_fileobj=os.path.join(script_dir, "server.js"), | |
| path_in_repo="server.js", | |
| repo_id=repo_id, | |
| repo_type="space", | |
| commit_message="Update server.js v1.8.0" | |
| ) | |
| print("Uploading Dockerfile directly...") | |
| api.upload_file( | |
| path_or_fileobj=os.path.join(script_dir, "Dockerfile"), | |
| path_in_repo="Dockerfile", | |
| repo_id=repo_id, | |
| repo_type="space", | |
| commit_message="Update Dockerfile" | |
| ) | |
| cat_path = os.path.join(script_dir, "data", "catalog.json") | |
| if os.path.exists(cat_path): | |
| print("Uploading pre-built catalog.json directly...") | |
| api.upload_file( | |
| path_or_fileobj=cat_path, | |
| path_in_repo="data/catalog.json", | |
| repo_id=repo_id, | |
| repo_type="space", | |
| commit_message="Bake pre-built 1,068 catalog entries into space repository" | |
| ) | |
| print("Restarting space container...") | |
| api.restart_space(repo_id=repo_id) | |
| print("SUCCESSFULLY DEPLOYED AND RESTARTED SPACE!") | |