| from huggingface_hub import HfApi | |
| # Replace with your Hugging Face username and desired model name | |
| repo_id = "PrzemekS/frcnn_cav" | |
| api = HfApi() | |
| # Create the repository (if it doesn't exist) | |
| api.create_repo(repo_id=repo_id, exist_ok=True, repo_type="model") | |
| local_model_path = "." # Assuming your script is in the same directory as the model files | |
| api = HfApi() | |
| # Upload the entire directory structure | |
| api.upload_folder( | |
| folder_path=local_model_path, | |
| repo_id=repo_id, | |
| repo_type="model", | |
| ) | |
| print(f"Model uploaded successfully to: https://huggingface.co/{repo_id}") | |