Skip to content

Flask API for training and predicting using scikit learn models

License

Notifications You must be signed in to change notification settings

cwallaceh/sklearnflask_docker

 
 

Repository files navigation

Flask API for scikit learn in Docker

A simple Flask application in a docker image that can serve predictions from a scikit-learn model inside a Docker container. Reads a pickled sklearn model into memory when the Flask app is started and returns predictions through the /predict endpoint. Any sklearn model can be used for prediction.

Dependencies

  • scikit-learn
  • Flask
  • pandas
  • numpy

Build the docker image

To build the docker image run:

docker build . -t model

Or run the file: 'create_image.sh'

Running the container

Run the docker container as:

docker run -p 8080:8080 model:latest

Or run the file: 'docker_run.sh'

Endpoints

/predict (POST)

Returns a dict with the prediction given a JSON object representing independent variables.

/info (GET)

Return the model info, version and help.

About

Flask API for training and predicting using scikit learn models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 77.4%
  • Shell 15.0%
  • Dockerfile 7.6%