Sasya-AI-Backend / scripts /upload_disease_model.py
Neel2601's picture
Sasya AI: replace farmer-ai-backend with 4-model API + Gradio UI
041a776
Raw
History Blame Contribute Delete
611 Bytes
# Upload disease model to Hugging Face Hub
# Run after: hf auth login (or set HF_TOKEN env var)
from huggingface_hub import HfApi
REPO = "Neel2601/sasya-disease-v2"
CKPT = "trained_models/disease_detection/best_model.pth"
CLASSES = "trained_models/disease_detection/classes.json"
api = HfApi()
api.create_repo(REPO, repo_type="model", exist_ok=True)
api.upload_file(path_or_fileobj=CKPT, path_in_repo="best_model.pth", repo_id=REPO, repo_type="model")
api.upload_file(path_or_fileobj=CLASSES, path_in_repo="classes.json", repo_id=REPO, repo_type="model")
print(f"Uploaded to https://huggingface.co/{REPO}")