| from huggingface_hub import HfApi | |
| import os | |
| # Define the repository name | |
| repo_name = "Tetratics/2018-11-08-OpenPsychometrics-IPIP-FFM" | |
| # Initialize the Hugging Face API | |
| api = HfApi() | |
| # Create the repository on Hugging Face | |
| api.create_repo(repo_id=repo_name, repo_type="dataset") | |
| # Upload each Parquet file to the repository | |
| for split_name in ["train", "validation", "test"]: | |
| file_path = f"{parquet_dir}/{split_name}.parquet" | |
| if os.path.exists(file_path): | |
| api.upload_file( | |
| path_or_fileobj=file_path, | |
| path_in_repo=f"{split_name}.parquet", | |
| repo_id=repo_name, | |
| repo_type="dataset" | |
| ) | |
| print(f"Uploaded {split_name}.parquet to {repo_name}") | |
| else: | |
| print(f"{split_name}.parquet not found. Skipping upload.") | |