| | """ |
| | 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 |
| |
|
| | |
| | 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 |
| |
|
| | |
| | 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() |
| | 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) |
| |
|
| | |
| | csv_path = Path(__file__).parent / "Dataset" / "image_mapping_with_questions.csv" |
| | print(f"\nUploading dataset from: {csv_path}") |
| |
|
| | |
| | sys.argv = [ |
| | "upload_with_images.py", |
| | str(csv_path), |
| | "--repo-id", |
| | "scholo/MMB_dataset" |
| | ] |
| |
|
| | upload_main() |
| |
|