This sample project contains a simple machine learning prediction API considering the traditional Iris flower classification problem. It is a REST API implemented with Flask, documented with Flasgger and served with uwsgi via Ngnix as a reverse proxy for high performance.
To build the docker image you can simply run ./build-docker-image.sh
from the root folder. You should be on a Unix environment with Docker installed. The ds-flask-app
image will be created.
After building the docker image, to run it simply issue ./docker-start.sh
. That will create a disposable container running the API. Point your browser to http://localhost/apidocs to check out the Swagger UI. You can try out the predictions right from your browser.
To develop locally (without docker) you should have pipenv installed.
To start the development server outside of docker, you should first run pipenv install
to install all dependencies and then simply execute ./dev-server.sh
.
The API uses an SVM model, which is created by running the training/create_model.py
file.
Some interesting parameter configurations to try out are threads
and processes
on the uwsgi
conf file in conf/uwsgi.ini
.