File size: 1,114 Bytes
fb238c5 | 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 | import time
from huggingface_hub import HfApi, login
# --- CONFIGURATION ---
# 1. Your Dataset ID (format: username/dataset-name)
REPO_ID = "enronarchive/mail"
# 2. Your local folder path (using 'r' for raw string is safer on Windows)
LOCAL_FOLDER = r"D:\git\enron-mail"
# ---------------------
# Optional: Login explicitly if not already logged in
# login(token="YOUR_WRITE_TOKEN_HERE")
api = HfApi()
print(f"Starting upload from '{LOCAL_FOLDER}' to '{REPO_ID}'...")
print("The library will automatically handle the 370k files in batches.")
try:
api.upload_folder(
folder_path=LOCAL_FOLDER,
repo_id=REPO_ID,
repo_type="dataset",
path_in_repo=".",
# This prevents uploading your git history and this script itself
ignore_patterns=[".git", ".gitattributes", "upload_script.py", ".gitignore"]
)
print("\n✅ Upload Complete! Your Enron Archive is live.")
except Exception as e:
print(f"\n❌ Error: {e}")
print("If it stopped, simply run this script again. It will verify existing files and resume.") |