AI-Powered Plant Disease Detection System Using CNN and Flask — Final Year Project with Source Code
Back to ProjectFollow the steps below to set up the PlantAI Plant Disease Detection project on your local machine. This guide covers environment setup, dependency installation, API configuration, and running the application.
git clone <your-repository-url>
cd leaf-health-detector-main
On macOS and Linux:
python3 -m venv .venv
source .venv/bin/activate
On Windows:
python -m venv .venv
.venv\Scripts\activate
pip install --upgrade pip
pip install -r requirements.txt
pip install stripe
Note: The stripe package is not currently listed in requirements.txt, so it must be installed separately using the command above.
Open app.py in any code editor. Locate the inline Groq API key and Stripe secret key and replace them with your own credentials. Before deploying publicly, move these values to environment variables:
import os
GROQ_API_KEY = os.environ.get("GROQ_API_KEY")
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY")
Check that the file plant_disease_model_1_latest.pt is present in the root project directory. If it is missing, the application will attempt to download it automatically from Google Drive using gdown when you first start the server.
python3 app.py
The application will start at:
http://127.0.0.1:5001
gunicorn app:app --bind 0.0.0.0:5001
python3 -m py_compile app.py CNN.py
This checks that both Python files parse correctly. It does not validate API credentials or external service connectivity.
A render.yaml configuration file is included in the repository. To deploy:
The disease_info.csv and supplement_info.csv files must remain index-aligned with the 39 class definitions in CNN.py. If you reorder rows in either CSV file, update the class list in CNN.py accordingly, otherwise predictions will map to incorrect disease entries.
Uploaded leaf images are stored in the static/uploads/ directory. Ensure this folder exists and that the web server process has write permissions to it on your deployment environment.
Our team is here to assist you with installation and setup.