Skip to content

mohitr2111/crop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crop Disease Detector

A comprehensive full-stack application designed to detect and classify crop diseases using machine learning. The project is split into three decoupled services:

  • Frontend: A sleek React user interface for image uploads and results display.
  • Backend API: A fast Node.js Express server to handle uploads and business logic.
  • ML Service: A robust Python FastAPI backend dedicated to running inference using TensorFlow.

🏗️ Architecture details

1. Frontend (/frontend)

  • Tech Stack: React 18, Tailwind CSS, Axios, React Router v6.
  • Role: Provides the user-facing interface (agrilens-frontend) to seamlessly upload plant photos and analyze results.
  • Port: Runs on http://localhost:3000 by default.

2. Backend (/backend)

  • Tech Stack: Node.js, Express, Mongoose (MongoDB), Multer.
  • Role: Acts as the main API layer. It coordinates file uploads, handles database connections, stores images in backend/uploads/, and manages CORS / security boundaries with Helmet.
  • Port: Runs on http://localhost:5001.

3. Machine Learning Service (/ml_service)

  • Tech Stack: Python 3.8+, FastAPI, TensorFlow, Pillow, OpenCV.
  • Role: Dedicated ML inference server. Reads .h5 models from the ml_service/models/ directory, processes images, and serves predictions via POST /predict/{model_name}.
  • Port: Runs on http://localhost:8000.

🚀 Getting Started

Prerequisites

  • Node.js (v16.0.0 or newer)
  • Python (v3.8 or newer)
  • MongoDB (Local or Atlas URI inside backend/.env)
  • Pre-trained .h5 model files.

One-Click Startup (Recommended)

To streamline launching all three services at once:

  1. Copy your trained TensorFlow model files (.h5) into the ml_service/models/ folder.
  2. Run the start.bat script located in the root directory.

The script will automatically verify your environment, install missing Node/Python packages across all three folders, spin up each service, and launch the web interface in your browser.


Manual Setup

If you prefer to start each service independently in separate terminal windows:

1. ML Service

cd ml_service
pip install -r requirements.txt
python simple_server.py

2. Node.js Backend

cd backend
npm install
npm run dev

3. React Frontend

cd frontend
npm install
npm start

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors