This is a Flask-based API for detecting plant diseases from images using a deep learning model. The API processes an image, runs it through a pre-trained model, and returns a prediction of the disease type.
- Accepts Base64-encoded images via a POST request
- Uses a deep learning model (
plant_disease_model.h5
) to classify plant diseases - Supports CORS for cross-origin requests
- Includes a health check endpoint
📁 DetectMe-Backend
│-- app.py # Main Flask API
│-- plant_disease_model.h5 # Trained model
│-- requirements.txt # Dependencies
git clone https://github.com/yourusername/DetectMe-backend.git
cd DetectMe-backend
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install -r requirements.txt
python app.py
By default, the API will run at http://127.0.0.1:5000/
.
Endpoint: /health
Method: GET
📌 Check if the API is running.
{
"status": "API is running"
}
Endpoint: /predict
Method: POST
📌 Send a Base64-encoded image to get disease prediction.
{
"image": "data:image/png;base64,...."
}
{
"disease": "Corn - Common Rust",
"confidence": 0.95,
"class_index": 0
}
⚠ Possible Errors
400
: Invalid or missing image data500
: Model loading or prediction failure
- Flask
- TensorFlow / Keras
- NumPy
- Pillow
- Flask-CORS
Install them using:
pip install -r requirements.txt
✅ Improve model accuracy
✅ Add more plant disease classes
✅ Deploy API to cloud (e.g., AWS, Heroku)
Feel free to fork, submit issues, or create pull requests! 🚀
MIT License © 2025 DetectMe Team