Spaces:
Running
Running
File size: 868 Bytes
41ce9e0 |
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 |
"""Uploads files/folders to HF hub for use with Spaces."""
import os
from huggingface_hub import Repository, HfApi
api = HfApi()
repo_id = "bpiyush/SoundOfWater"
repo_type = "space"
upload_file = "upload_to_hub.py"
if upload_file is not None:
print("Uploading file: ", upload_file)
assert isinstance(upload_file, str), "Please provide a valid file path."
api.upload_file(
path_or_fileobj=f"./{upload_file}",
path_in_repo=upload_file,
repo_id=repo_id,
repo_type=repo_type,
)
upload_folder = None
if upload_folder is not None:
print("Uploading folder: ", upload_folder)
assert isinstance(upload_folder, str), "Please provide a valid folder path."
api.upload_folder(
folder_path=f"./{upload_folder}",
path_in_repo=upload_folder,
repo_id=repo_id,
repo_type=repo_type,
) |