How joker-qp/leafai works
Leafai is a web-based plant-leaf disease diagnosis and active-learning system. Users submit one or more images, including camera captures, receive ranked plant/disease predictions with confidence warnings, and can confirm or correct labels. Confirmed and corrected images enter a data pool that can be used for fine-tuning; the repository also provides a separate PlantVillage training pipeline. The frontend and some documented capabilities are represented from the README and file tree; their source was not sampled, so uncertain internal wiring is omitted.
Main entry points: main.py FastAPI Service · retrain.py Pool Fine-Tuning · index.html Web UI · train_model.py PlantVillage Training
Components 14
Web Diagnosis
- Web UI
index.html - FastAPI Service
main.py
Inference
- Image Preprocessing
predict.py - Disease Classifier
predict.py - Model Weights
models/leaf_disease_model.pth - Class Names
models/class_names.json
Feedback Learning
- Pending Images
- Feedback Data Pool
data_pool - Feedback Log
data/feedback_log.jsonl
Model Training
- Pool Fine-Tuning
retrain.py - Archived Pool
- PlantVillage Training
train_model.py
Other components
- User
- PlantVillage Dataset
Connections 20
- User → Web UI: submits images
- Web UI → FastAPI Service: uploads batch
- FastAPI Service → Image Preprocessing: requests prediction
- Image Preprocessing → Disease Classifier: prepares image
- Disease Classifier → Model Weights: loads weights
- Disease Classifier → Class Names: loads labels
- FastAPI Service → Web UI: returns results
- FastAPI Service → Pending Images: saves image
- Web UI → FastAPI Service: sends correction
- FastAPI Service → Pending Images: reads image
- FastAPI Service → Feedback Data Pool: moves labeled image
- FastAPI Service → Feedback Log: appends feedback
- User → Pool Fine-Tuning: starts retraining
- Pool Fine-Tuning → Feedback Data Pool: loads images
- Pool Fine-Tuning → Model Weights: loads and updates
- Pool Fine-Tuning → Class Names: loads labels
- Pool Fine-Tuning → Archived Pool: moves processed images
- PlantVillage Training → PlantVillage Dataset: downloads data
- PlantVillage Training → Model Weights: saves weights
- PlantVillage Training → Class Names: saves labels