#!/usr/bin/env python3 """ Upload script for Hugging Face dataset. Run this after logging in with: huggingface-cli login """ from huggingface_hub import HfApi, create_repo from pathlib import Path import os # Configuration DATASET_NAME = "anime-characters" DATASET_DIR = "huggingface_dataset" def upload_dataset(): api = HfApi() # Get username username = api.whoami()["name"] repo_id = f"{username}/{DATASET_NAME}" print(f"Creating repository: {repo_id}") # Create repository try: create_repo(repo_id, repo_type="dataset", private=False) print("Repository created successfully!") except Exception as e: print(f"Repository might already exist: {e}") # Upload files print("Uploading files...") api.upload_folder( folder_path=DATASET_DIR, repo_id=repo_id, repo_type="dataset", ) print(f"\nDataset uploaded successfully!") print(f"View your dataset at: https://huggingface.co/datasets/{repo_id}") if __name__ == "__main__": upload_dataset()