Spaces:
Sleeping
Sleeping
File size: 599 Bytes
18495da | 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 | from huggingface_hub import HfApi, login
import os
HF_USERNAME = "SharleyK"
SPACE_NAME = "PredictiveMaintenance"
HF_TOKEN = os.getenv("HF_TOKEN")
if not HF_TOKEN:
raise RuntimeError("HF_TOKEN environment variable not set")
login(token=HF_TOKEN)
api = HfApi()
repo_id = f"{HF_USERNAME}/{SPACE_NAME}"
api.create_repo(
repo_id=repo_id,
repo_type="space",
space_sdk="docker",
exist_ok=True
)
api.upload_folder(
folder_path=".",
repo_id=repo_id,
repo_type="space"
)
print("Deployment successful!")
print(f"https://huggingface.co/spaces/{HF_USERNAME}/{SPACE_NAME}")
|