Datasets:
Download tools/upload_huggingface.py from bensblueprints/consistent-pet: direct link, hf CLI and curl.
- Browser
- Download file 651 Bytes
-
https://huggingface.co/datasets/bensblueprints/consistent-pet/resolve/main/tools/upload_huggingface.py
- Command line
-
hf download hf://datasets/bensblueprints/consistent-pet/tools/upload_huggingface.py
-
curl -L -o upload_huggingface.py https://huggingface.co/datasets/bensblueprints/consistent-pet/resolve/main/tools/upload_huggingface.py
651 Bytes
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| root=Path(__file__).resolve().parent.parent | |
| api=HfApi() | |
| assert api.whoami()['name']=='bensblueprints','Wrong Hugging Face account' | |
| api.create_repo('bensblueprints/consistent-pet',repo_type='dataset',private=False,exist_ok=True) | |
| api.upload_large_folder(repo_id='bensblueprints/consistent-pet',repo_type='dataset',folder_path=root,num_workers=6, | |
| allow_patterns=['references/**','previews/**','print-variants/**','tools/*.py','README.md','catalog.json','catalog.csv','metadata.jsonl','inventory.json','index.html','gallery-data.js'],print_report_every=30) | |
| print('Hugging Face upload finished') | |