Skip to content

Adarsh73111/cropguard-ai

Repository files navigation

🌿 CropGuard AI

AI-powered crop disease detection system built with PyTorch and deployed on AWS

Live Demo GitHub Python PyTorch AWS

Upload a leaf photo → Get instant disease diagnosis + treatment advice


🔴 Live Demo

👉 Try it here


📸 Screenshots

Upload a leaf photo and get instant diagnosis with treatment recommendations


📊 Model Performance

Metric Value
Algorithm EfficientNet-B0 (Transfer Learning)
Dataset PlantVillage (20,638 images)
Classes 15 disease classes
Validation Accuracy 94.53%
Training Platform Google Colab (T4 GPU)
Model Size 15.65 MB

☁️ AWS Architecture

User Browser
     │
     ▼
Nginx (Port 80)          ← Reverse Proxy
     │
     ▼
Gunicorn + Flask         ← WSGI Server (EC2 t3.small)
     │
     ▼
EfficientNet-B0          ← ML Inference (CPU)
     │
     ▼
AWS S3                   ← Model Storage (IAM Role)

AWS Services Used

  • EC2 t3.small — Ubuntu 24.04, serves the app 24/7
  • S3 — stores model weights securely
  • IAM Role — secure S3 access, zero credentials stored on server
  • Nginx — reverse proxy on port 80
  • Gunicorn — production WSGI server
  • CloudWatch — monitoring and logs

🌱 Supported Crops & Diseases

Crop Diseases Detected
🍅 Tomato Early Blight, Late Blight, Leaf Mold, Bacterial Spot, Septoria Leaf Spot, Spider Mites, Target Spot, Yellow Leaf Curl Virus, Mosaic Virus, Healthy
🥔 Potato Early Blight, Late Blight, Healthy
🫑 Bell Pepper Bacterial Spot, Healthy

🚀 Run Locally

Option 1 — With Docker (Recommended)

# 1. Clone the repo
git clone https://github.com/Adarsh73111/cropguard-ai.git
cd cropguard-ai

# 2. Build and run
docker-compose up

# 3. Open browser
http://localhost:5000

Option 2 — Without Docker

# 1. Clone the repo
git clone https://github.com/Adarsh73111/cropguard-ai.git
cd cropguard-ai

# 2. Install dependencies
pip install -r requirements.txt

# 3. Run the app
python app.py

# 4. Open browser
http://localhost:5000

Prerequisites for Docker: Install Docker Desktop


🛠️ Tech Stack

Category Technology
ML Framework PyTorch
Model EfficientNet-B0
Web Framework Flask
WSGI Server Gunicorn
Reverse Proxy Nginx
Cloud AWS EC2, S3, IAM
Demo Platform Hugging Face Spaces + Gradio
Training Google Colab (T4 GPU)

📁 Project Structure

cropguard-ai/
├── app.py                  ← Flask inference API + frontend
├── index.html              ← Web UI
├── cropguard_model.pth     ← Trained EfficientNet-B0 model
├── class_names.json        ← Disease class labels
├── requirements.txt        ← Python dependencies
├── Dockerfile              ← Docker container setup
├── docker-compose.yml      ← Docker compose config
└── README.md

👨‍💻 Author

Adarsh


📄 License

MIT License — feel free to use and modify!


Made with ❤️ using PyTorch and AWS

About

AI-powered crop disease detection system deployed on AWS — upload a leaf photo, get instant disease diagnosis and treatment advice.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors