This is a Flask-based API for classifying cacao pod images using an EfficientNetB0 model. The API provides an endpoint to classify an uploaded image and returns the predicted class along with confidence scores.
- Python 3.x
- Flask
- Flask-CORS
- TensorFlow
- scikit-learn
- scikit-image
- Clone the repository
git clone https://github.com/louispawaon/sikwati-ai-backend.git
cd sikwati-ai-backend
- Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate
- Install Python dependencies
pip install -r requirements.txt
- Run the application
gunicorn app:app #For Production
flask run --debug #For Debugging Mode
- (Optional) Expose the local server using Ngrok
ngrok http 5000
Ngrok will provide a public URL (e.g., https://your-ngrok-subdomain.ngrok.io) that you can use to access your API from anywhere.
- Endpoint:
/
- Description: Welcome to Sikwati AI API
- Method:
GET
- Response:
{
"message": "Welcome to the Cacao Pod Classification API"
}
- Endpoint:
/api/classify_image
- Description: Classify an uploaded cacao pod image
- Method:
POST
- Request Parameters:
image
(type: file, required: true) - The cacao pod image to be classified
- Responses:
- 200 OK
{ "class": "predicted_class", "confidence": 0.85 }
- 400 Bad Request
{ "error": "No file part" }
{ "error": "No selected file" }
{ "error": "The image may not contain a cacao pod" }
- 200 OK
- The classification model is based on the EfficientNetB0 CNN Architecture