Scripts Directory
This folder contains utility scripts for model preparation and deployment.
Files
prepare_model.py
Trains the model and generates deployment artifacts.
Usage:
python scripts/prepare_model.py
Output:
model/model.joblib- Trained modelmodel/config.json- Model configurationrequirements.txt- DependenciesREADME.md- Model card
upload_to_hf.py
Uploads the model and applications to Hugging Face Hub.
Usage:
# 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
- Run
prepare_model.pyto train and export the model - Run
upload_to_hf.pyto deploy to Hugging Face