Spaces:
Sleeping
Sleeping
File size: 1,010 Bytes
df058ca |
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 |
from huggingface_hub import hf_hub_download
from huggingface_hub import login
from huggingface_hub import HfApi
from huggingface_hub import snapshot_download
#not that when passing a file path with "-" in the name add double slashes so it's accpeted by Python
def upload_file(token, local_path, repo_path, repo_id, repo_type):
#Whenever you want to upload files to the Hub, you need to log in to your Hugging Face account
login(token=token)
api = HfApi()
api.upload_file(
path_or_fileobj=local_path,
path_in_repo=repo_path,
repo_id=repo_id,
repo_type=repo_type,
)
def upload_folder(token, local_path, repo_path, repo_id, repo_type,ignore_patterns):
#Whenever you want to upload files to the Hub, you need to log in to your Hugging Face account
login(token=token)
api = HfApi()
api.upload_folder(
folder_path=local_path,
path_in_repo=repo_path,
repo_id=repo_id,
repo_type=repo_type,
ignore_patterns=ignore_patterns,
) |