#!/usr/bin/env python3 """Upload the dataset to the Hugging Face Hub. Uploads only README.md and data/** (raw/ and scripts/ stay local). The repository is created private and gated; make it public when you are happy with how it looks: python scripts/upload.py --public Before the first run: hf auth login (token with "Write" permission) """ import argparse from pathlib import Path from huggingface_hub import HfApi ROOT = Path(__file__).resolve().parent.parent def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("--repo-id", default="aizana1/tuvan-vk-corpus") parser.add_argument("--public", action="store_true", help="make the repository public (it stays gated)") parser.add_argument("--message", default="Upload dataset") args = parser.parse_args() api = HfApi() print("Logged in as:", api.whoami()["name"]) api.create_repo(args.repo_id, repo_type="dataset", private=True, exist_ok=True) # Gated: users fill in the form from README.md before they can download files. api.update_repo_settings(args.repo_id, repo_type="dataset", gated="auto") api.upload_folder( repo_id=args.repo_id, repo_type="dataset", folder_path=ROOT, allow_patterns=["README.md", "data/**/*.parquet"], commit_message=args.message, ) if args.public: api.update_repo_settings(args.repo_id, repo_type="dataset", private=False) print(f"Done: https://huggingface.co/datasets/{args.repo_id}") if __name__ == "__main__": main()