Best Flask open-source libraries and packages

Sikwati ai backend

Flask-based API for classifying cacao pod images using an EfficientNetB0 model.
Updated 5 months ago

Sikwati-AI API

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.

Getting Started

Prerequisites

  • Python 3.x
  • Flask
  • Flask-CORS
  • TensorFlow
  • scikit-learn
  • scikit-image

Installation

  1. Clone the repository
git clone https://github.com/louispawaon/sikwati-ai-backend.git
cd sikwati-ai-backend
  1. Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate
  1. Install Python dependencies
pip install -r requirements.txt
  1. Run the application
gunicorn app:app #For Production
flask run --debug #For Debugging Mode
  1. (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.

Usage

Home Endpoint

  • Endpoint: /
  • Description: Welcome to Sikwati AI API
  • Method: GET
  • Response:
{
  "message": "Welcome to the Cacao Pod Classification API"
}

Classify Image Endpoint

  • 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"
      }

Model Details

  • The classification model is based on the EfficientNetB0 CNN Architecture

Author

Louis Miguel Pawaon