CoolFace
Datasetpublic

SharleyK/PredictiveMaintenance

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes38downloads
data_register.py26 linesDownload Raw Back to root
1from huggingface_hub.utils import RepositoryNotFoundError, HfHubHTTPError2from huggingface_hub import HfApi, create_repo3import os4 5 6repo_id = "SharleyK/PredictiveMaintenance"7repo_type = "dataset"8 9# Initialize API client10api = HfApi(token=os.getenv("HF_TOKEN"))11 12# Step 1: Check if the space exists13try:14    api.repo_info(repo_id=repo_id, repo_type=repo_type)15    print(f"Space '{repo_id}' already exists. Using it.")16except RepositoryNotFoundError:17    print(f"Space '{repo_id}' not found. Creating new space...")18    create_repo(repo_id=repo_id, repo_type=repo_type, private=False)19    print(f"Space '{repo_id}' created.")20 21api.upload_folder(22    folder_path="engine_predictive_maintenance/data",23    repo_id=repo_id,24    repo_type=repo_type,25)26