| # Scripts Directory | |
| This folder contains utility scripts for model preparation and deployment. | |
| ## Files | |
| ### `prepare_model.py` | |
| Trains the model and generates deployment artifacts. | |
| **Usage:** | |
| ```bash | |
| python scripts/prepare_model.py | |
| ``` | |
| **Output:** | |
| - `model/model.joblib` - Trained model | |
| - `model/config.json` - Model configuration | |
| - `requirements.txt` - Dependencies | |
| - `README.md` - Model card | |
| ### `upload_to_hf.py` | |
| Uploads the model and applications to Hugging Face Hub. | |
| **Usage:** | |
| ```bash | |
| # Interactive login | |
| python scripts/upload_to_hf.py | |
| # With token | |
| python scripts/upload_to_hf.py --token hf_YOUR_TOKEN | |
| # Upload model only (skip Gradio Space) | |
| python scripts/upload_to_hf.py --token hf_YOUR_TOKEN --no-space | |
| ``` | |
| **Uploads to:** | |
| - Model repository: `chenhaoq87/MilkSpoilageClassifier` | |
| - Gradio Space: `chenhaoq87/MilkSpoilageClassifier-Demo` | |
| ## Workflow | |
| 1. Run `prepare_model.py` to train and export the model | |
| 2. Run `upload_to_hf.py` to deploy to Hugging Face | |