| |
| |
| |
| from huggingface_hub import HfApi |
| from datetime import datetime |
|
|
| def check_dataset_sync(hf_token=None): |
| api = HfApi(token=hf_token) |
| repo_id = "toecm/PureChain_Dataset" |
| |
| print(f"🔍 Checking sync status for cloud repository: {repo_id}\n") |
| |
| try: |
| |
| files = api.list_repo_files(repo_id=repo_id, repo_type="dataset") |
| print("📁 Files currently synced in the cloud:") |
| for f in files: |
| if f.endswith('.csv') or f.endswith('.json'): |
| print(f" └─ {f}") |
| |
| |
| print("\n🕒 Recent Sync History:") |
| commits = api.list_repo_commits(repo_id=repo_id, repo_type="dataset") |
| |
| |
| for commit in commits[:3]: |
| |
| time_str = commit.created_at.strftime("%Y-%m-%d %H:%M:%S") |
| print(f" [{time_str}] {commit.title}") |
| |
| except Exception as e: |
| print(f"❌ Sync Check Failed: {e}") |
| print("Make sure the repository is created and your token has Read access.") |
|
|
| import os |
| |
| |
| from huggingface_hub import HfApi |
| from datetime import datetime |
|
|
| def check_dataset_sync(hf_token=None): |
| api = HfApi(token=hf_token) |
| repo_id = "toecm/PureChain_Dataset" |
| |
| print(f"🔍 Checking sync status for cloud repository: {repo_id}\n") |
| |
| try: |
| |
| files = api.list_repo_files(repo_id=repo_id, repo_type="dataset") |
| print("📁 Files currently synced in the cloud:") |
| for f in files: |
| if f.endswith('.csv') or f.endswith('.json'): |
| print(f" └─ {f}") |
| |
| |
| print("\n🕒 Recent Sync History:") |
| commits = api.list_repo_commits(repo_id=repo_id, repo_type="dataset") |
| |
| |
| for commit in commits[:3]: |
| |
| time_str = commit.created_at.strftime("%Y-%m-%d %H:%M:%S") |
| print(f" [{time_str}] {commit.title}") |
| |
| except Exception as e: |
| print(f"❌ Sync Check Failed: {e}") |
| print("Make sure the repository is created and your token has Read access.") |
|
|
| |
| check_dataset_sync("HF_TOKEN") |
| |
| check_dataset_sync(os.environ.get("HF_TOKEN")) |