File size: 1,536 Bytes
71f5c5b | 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 35 36 37 38 39 40 41 42 43 44 45 46 47 | """
Upload MMB dataset with inline images to Hugging Face.
This will authenticate and push the dataset with Image columns.
"""
from pathlib import Path
import sys
# Add the upload script path
sys.path.insert(0, str(Path(__file__).parent.parent / "MMB-Space" / "Datasetviewer"))
from huggingface_hub import login, whoami
from scripts.upload_to_huggingface import main as upload_main
# Check if logged in
try:
user = whoami()
print(f"Logged in as: {user['name']}")
except Exception:
print("Not logged in. Attempting browser login...")
print("If browser doesn't open, get a token from: https://huggingface.co/settings/tokens")
print("Then set environment variable: $env:HF_TOKEN='your_token'")
try:
login() # Will open browser or use HF_TOKEN env var
user = whoami()
print(f"Logged in as: {user['name']}")
except Exception as e:
print(f"Login failed: {e}")
print("\nTo authenticate manually:")
print("1. Get token from: https://huggingface.co/settings/tokens")
print("2. Run: $env:HF_TOKEN='your_token'")
print("3. Then run this script again")
sys.exit(1)
# Run the upload (use Dataset folder - change to "dataset_1k_720p_2" if needed)
csv_path = Path(__file__).parent / "Dataset" / "image_mapping_with_questions.csv"
print(f"\nUploading dataset from: {csv_path}")
# Modify sys.argv to simulate command line args
sys.argv = [
"upload_with_images.py",
str(csv_path),
"--repo-id",
"scholo/MMB_dataset"
]
upload_main()
|