How sthasus/tomato_leaf_disease_detection works
Tomato Leaf Disease Detector is a Django application for account-based tomato-leaf diagnosis. A user signs up or logs in, uploads a JPG/PNG leaf image, and receives a predicted class, confidence, care guidance, and optionally an explanation; logged-in users can revisit saved predictions, while model metrics are public. Separately, the documented training workflow produces the model and metrics consumed by the app. The request and inference paths are shown from excerpts; training-to-artifact links follow README documentation, since the notebook was not sampled.
Main entry points: views.py Upload handler · urls.py Detector routes · inference.py Image inference · train.ipynb Model training
Components 19
Web application
- Detector routes
detector/urls.py - Landing page
detector/views.py - Upload handler
detector/views.py - Image validation
detector/forms.py - Prediction history
detector/views.py - Metrics page
detector/views.py - Prediction records
detector/models.py - Uploaded images
media/uploads
Accounts
- Account routes
accounts/urls.py - Signup handler
accounts/views.py - Signup validation
accounts/forms.py
Diagnosis
- Image inference
detector/inference.py - LIME explanation
detector/explain.py - Disease guidance
detector/disease_info.py
Model lifecycle
- Model training
ml_model/train.ipynb - Model weights
ml_model/saved_model - Class labels
ml_model/class_names.json - Model metrics
ml_model/metrics.json
Other components
- Visitor
Connections 24
- Visitor → Detector routes: requests pages
detector/urls.py - Detector routes → Landing page: routes to
detector/urls.py - Detector routes → Upload handler: routes to
detector/urls.py - Detector routes → Prediction history: routes to
detector/urls.py - Detector routes → Metrics page: routes to
detector/urls.py - Visitor → Account routes: requests account
accounts/urls.py - Account routes → Signup handler: routes to
accounts/urls.py - Signup handler → Signup validation: uses form
accounts/views.py - Upload handler → Image validation: validates upload
detector/views.py - Upload handler → Uploaded images: saves image
detector/views.py - Upload handler → Image inference: predicts image
detector/views.py - Image inference → Model weights: loads weights
README.md - Image inference → Class labels: loads labels
README.md - Upload handler → Disease guidance: gets care tips
detector/views.py - Upload handler → Prediction records: saves result
detector/views.py - Upload handler → LIME explanation: optionally explains
detector/views.py - LIME explanation → Image inference: reuses model
detector/inference.py - Prediction history → Prediction records: reads history
detector/views.py - Prediction history → Disease guidance: gets care tips
detector/views.py - Metrics page → Model metrics: reads metrics
README.md - Metrics page → Disease guidance: formats labels
detector/views.py - Model training → Model weights: exports weights
README.md - Model training → Class labels: exports labels
README.md - Model training → Model metrics: exports metrics
README.md