Spaces:
Paused
Paused
File size: 1,139 Bytes
f27d71d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 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!")
|