Download scripts/upload.py from anonymous-quantinv/hybrid50: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/datasets/anonymous-quantinv/hybrid50/resolve/main/scripts/upload.py
- Command line
-
hf download hf://datasets/anonymous-quantinv/hybrid50/scripts/upload.py
-
curl -L -o upload.py https://huggingface.co/datasets/anonymous-quantinv/hybrid50/resolve/main/scripts/upload.py
1.3 kB
| #!/usr/bin/env python3 | |
| """Verify and publish this directory to a public Hugging Face dataset repository.""" | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| from verify_release import verify | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("repo_id", help="For example anonymous-quantinv/hybrid50") | |
| args = parser.parse_args() | |
| verify(check_parquet=True) | |
| root = Path(__file__).resolve().parents[1] | |
| manifest = json.loads((root / "manifest.json").read_text(encoding="utf-8")) | |
| api = HfApi() | |
| api.create_repo(args.repo_id, repo_type="dataset", private=False, exist_ok=True) | |
| if api.repo_info(args.repo_id, repo_type="dataset").private: | |
| raise ValueError("The existing repository is private; choose a public dataset repository.") | |
| info = api.upload_folder( | |
| repo_id=args.repo_id, | |
| repo_type="dataset", | |
| folder_path=root, | |
| allow_patterns=[*manifest["files"], "manifest.json"], | |
| ignore_patterns=[".git/**", ".cache/**", "__pycache__/**", "*.pyc"], | |
| commit_message="Publish Hybrid50 contextual dataset with provenance and validation", | |
| ) | |
| print(info.commit_url) | |
| if __name__ == "__main__": | |
| main() | |