Download hf_upload.py from Albidar/combilatent: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/Albidar/combilatent/resolve/main/hf_upload.py
- Command line
-
hf download hf://Albidar/combilatent/hf_upload.py
-
curl -L -o hf_upload.py https://huggingface.co/Albidar/combilatent/resolve/main/hf_upload.py
1.08 kB
| import os | |
| from huggingface_hub import HfApi | |
| def main(): | |
| token = os.getenv("HF_TOKEN") | |
| if not token: | |
| raise ValueError( | |
| "HF_TOKEN environment variable not set. Please export it before running." | |
| ) | |
| api = HfApi(token=token) | |
| # Your repository details | |
| repo_id = "albidar-solutions/combilatent" | |
| repo_type = "model" | |
| print(f"Creating/verifying repository: {repo_id}...") | |
| api.create_repo(repo_id=repo_id, repo_type=repo_type, exist_ok=True) | |
| # Define files/folders to strictly ignore | |
| ignore_list = [ | |
| # "hf_upload.py", | |
| ".git/", | |
| "__pycache__/", | |
| "*.log", | |
| ".DS_Store", | |
| ] | |
| print(f"Starting large folder upload of the current directory to HF...") | |
| # Using the optimized large folder method | |
| api.upload_large_folder( | |
| folder_path=".", # Current directory | |
| repo_id=repo_id, | |
| repo_type=repo_type, | |
| ignore_patterns=ignore_list, | |
| ) | |
| print("Upload complete! Everything was pushed successfully.") | |
| if __name__ == "__main__": | |
| main() | |