Download src/upload_model.py from Decoder24/Cataract-ViT: direct link, hf CLI and curl.
- Browser
- Download file 479 Bytes
-
https://huggingface.co/Decoder24/Cataract-ViT/resolve/main/src/upload_model.py
- Command line
-
hf download hf://Decoder24/Cataract-ViT/src/upload_model.py
-
curl -L -o upload_model.py https://huggingface.co/Decoder24/Cataract-ViT/resolve/main/src/upload_model.py
479 Bytes
| from huggingface_hub import HfApi | |
| api = HfApi() | |
| # ganti dengan repo kamu di Hugging Face | |
| repo_id = "Decoder24/ViT-for-Limited-Medical-Data" | |
| model_path = r"C:\Users\user\Documents\Project\Cataract-ViT\outputs\models\best_swin_weights_only.pth" | |
| # Upload ke repo | |
| api.upload_file( | |
| path_or_fileobj=model_path, | |
| path_in_repo="best_swin_weights_only.pth", | |
| repo_id=repo_id, | |
| repo_type="model" | |
| ) | |
| print("✅ File berhasil diupload ke Hugging Face Hub!") | |