Shubham9008/leaf_detection_eith_gatekeeper
0
π₯ Potato Disease Detection System (Gatekeeper-Based)
A deep learningβbased web application for detecting potato leaf diseases using a gatekeeper-first architecture. The system is built with FastAPI, TensorFlow, and custom HTML/CSS/JS.
π‘ System Pipeline (Two-Stage Pipeline)
To prevent false classifications from irrelevant images (such as background, soil, or hands), the system validates images before performing diagnosis:
- π‘οΈ The Gatekeeper (Validation Stage)
- Task: Binary Classification (Leaf vs. Non-Leaf).
- Role: Evaluates the image and filters out any non-leaf objects.
- Accuracy: ~79% (MobileNetV2 backbone).
- π¬ The Classifier (Diagnostic Stage)
- Task: Multi-class Classification.
- Classes:
Healthy,Early Blight,Late Blight. - Accuracy: ~85% (Sequential CNN model).
π Repository Structure
- api/app.py - FastAPI backend containing validation & prediction pipelines.
- templates/index.html - Main application frontend.
- static/ - Custom CSS styling and Javascript frontend logic.
- Dockerfile - Docker configuration file for Hugging Face Spaces deployment.
π How to Run Locally
1. Synchronize Dependencies
uv sync2. Run the Application
uv run python main.pyOpen http://127.0.0.1:8000 in your web browser.
π How to Deploy to Hugging Face Spaces
- Create a new Space on Hugging Face.
- Select Docker as the SDK (select the Blank template).
- Push your repository's deployment branch to the Hugging Face space repository. Hugging Face will read the Dockerfile and launch the web server automatically.
