CoolFace
Apppublic

khhamid/plants-diseases-detection

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
App README

๐ŸŒฟ Plant Diseases Classifier (MobileNetV3 + TFLite)

![Hugging Face Space](https://huggingface.co/spaces/khhamid/plants-diseases-detection)

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

ComponentDescription
ArchitectureMobileNetV3-Small (fine-tuned)
DatasetPlant Diseases Dataset
Classes38 different plant species and diseases
OptimizationINT8 Quantization (TensorFlow Lite)
Performance98%+ accuracy, 90% size reduction

๐Ÿ“‚ Project Structure

bash
.
โ”œโ”€โ”€ 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

bash
git clone https://github.com/<your-username>/plants-diseases-lite.git
cd plants-diseases-lite

Install dependencies

bash
pip install -r requirements.txt

Run the app

bash
streamlit run src/app.py --server.port=7860

Then open: http://localhost:7860

Docker Deployment

1 Build the image

bash
docker build -t plants-diseases-lite .

2 Run the container

bash
docker run -p 7860:7860 plants-diseases-lite

Open 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 ๐ŸŒฑ