Plant Disease Diagnosis Assistant

Plant Disease Diagnosis Assistant is an end-to-end AI application that classifies plant leaf diseases from images and answers follow-up questions about symptoms, causes, treatment, prevention, and general diagnosis information. :chatgpt-content-reference{index="0"}

What it does

Users can upload a plant leaf image, receive a disease prediction with confidence, and then ask natural-language follow-up questions about the diagnosed condition. The system combines image classification, a DistilBERT-based intent classifier, and a structured plant disease knowledge base. :chatgpt-content-reference{index="1"} :chatgpt-content-reference{index="2"}

How I built it

I trained and evaluated three image classification approaches: a custom FlexibleCNN, ResNet18, and MobileNetV3. I also used Optuna for hyperparameter tuning and compared the models across accuracy, Macro-F1, model size, and inference latency. :chatgpt-content-reference{index="3"}

The best-performing model was ResNet18, which achieved:

  • 99.39% test accuracy
  • 99.44% Macro-F1

The DistilBERT intent classifier achieved 94.92% test accuracy and 94.85% test F1 across five intent categories: symptoms, cause, treatment, prevention, and general. :chatgpt-content-reference{index="4"} :chatgpt-content-reference{index="5"}

System architecture

The application uses a Streamlit frontend and a FastAPI backend. The backend serves the fine-tuned ResNet18 and DistilBERT models through REST endpoints, while the frontend communicates with the backend over HTTPS. :chatgpt-content-reference{index="6"}

Deployment

The FastAPI backend is containerized with Docker and deployed on Google Cloud Run, while the frontend is hosted on Streamlit Community Cloud. :chatgpt-content-reference{index="7"}

I also optimized the deployment environment by separating training and inference dependencies and using CPU-only PyTorch. This reduced the Docker image size from 9.84 GB to 2.21 GB, while preserving the /health, /predict, and /ask endpoints. :chatgpt-content-reference{index="8"}

Live Demo

Open Plant Disease Diagnosis Assistant

Built with

Python, PyTorch, ResNet18, MobileNetV3, DistilBERT, Hugging Face Transformers, Optuna, FastAPI, Streamlit, Docker, Google Cloud Run

Built With

  • distilbert
  • docker
  • fastapi
  • google-cloud-run
  • hugging-face-transformers
  • mobilenetv3
  • optuna
  • python
  • pytorch
  • resnet18
  • streamlit
Share this project:

Updates