khhamid/plants-diseases-detection
๐ฟ Plant Diseases Classifier (MobileNetV3 + TFLite)

An optimized plant disease detection web app built using TensorFlow, MobileNetV3, and Streamlit, with quantized TFLite deployment for efficient inference on the web, cloud, and edge devices. This project demonstrates real-world model optimization, containerized deployment, and automated CI/CD to Hugging Face Spaces and Docker Hub.
๐ Features
- โ Fine-tuned MobileNetV3-Small for accurate plant disease recognition
- โก TFLite quantization (INT8) for ultra-fast inference
- ๐ Streamlit-based web interface for image upload and prediction
- ๐ฆ Dockerized environment for reproducible builds
- ๐ค CI/CD pipeline that automatically pushes to:
- Docker Hub
- Hugging Face Models & Spaces
๐ง Model Overview
๐ Project Structure
.
โโโ models/
โ โโโ mobilenet_int8.tflite # Quantized model
โโโ src/
โ โโโ app.py # Streamlit web app
โโโ class_names.txt # Class labels
โโโ requirements.txt # Python dependencies
โโโ Dockerfile # Container setup
โโโ .github/workflows/hf_deploy.yml # CI/CD workflow
โโโ README.md๐งฐ Local Setup
Clone the repository
git clone https://github.com/<your-username>/plants-diseases-lite.git
cd plants-diseases-liteInstall dependencies
pip install -r requirements.txtRun the app
streamlit run src/app.py --server.port=7860Then open: http://localhost:7860
Docker Deployment
1 Build the image
docker build -t plants-diseases-lite .2 Run the container
docker run -p 7860:7860 plants-diseases-liteOpen your browser at http://localhost:7860
๐ค Hugging Face Integration
This project includes a full CI/CD pipeline that automatically:
- Builds the app
- Pushes the Docker image to Docker Hub
- Uploads the quantized model to Hugging Face Model Hub
- Deploys the Streamlit app to Hugging Face Spaces
๐ Results Metric | Keras Model | TFLite INT8 | |-----|------------|-------------| Accuracy | 98% | 98% | Avg Inference Time | - ms | ~2.7 ms | Model Size | 22.4 MB | 1.0 MB |
๐ Live Demo
Try it live on Hugging Face Spaces ๐ ๐ https://huggingface.co/spaces/khhamid/plants-diseases-lite-app
Future Work
- ๐ฑ Deploy on edge & mobile devices using:
- โ๏ธ Add backend API for large-scale cloud predictions
- ๐พ Expand dataset with real-world agricultural images
- ๐ท Enable live camera inference for instant in-field diagnosis
๐ชด License
This project is released under the MIT License. You are free to use, modify, and distribute it with attribution.
Refs:
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
โญ If you like this project, give it a star!
Your feedback helps improve open-source AI for agriculture ๐ฑ
