Skip to content

Sample data science project using Flask, Flasgger, uwsgi, nginx and Docker

Notifications You must be signed in to change notification settings

cmmp/ds-flask-nginx-docker

Repository files navigation

Sample data science project using Flask, Flasgger, uwsgi and nginx

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.

Build

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.

Running

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.

Screenshot

Dev server

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.

Training

The API uses an SVM model, which is created by running the training/create_model.py file.

Configuration

Some interesting parameter configurations to try out are threads and processes on the uwsgi conf file in conf/uwsgi.ini.

About

Sample data science project using Flask, Flasgger, uwsgi, nginx and Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published