This project will contain all the necessary files and scripts to operationalize a Machine Learning Microservice API. The operationalized API is a Python flask app that serves out predictions (inference) about housing prices through API calls.
This project could be extended to any pre-trained machine learning model, such as those for image recognition and data labeling.
This API is using a pre-trained, sklearn
model that has been trained to predict housing prices in Boston according to several features, such as average rooms in a home and data about highway access, teacher-to-pupil ratios, and so on. You can read more about the data, which was initially taken from Kaggle, on the data source site.
app.py
contains the code for the Python flask apprequirements.txt
contains a list of Python dependencies needed for the Python flask appmake_prediction.sh
runs a prediction using the operationalized APIrun_docker.sh
builds a docker image for the Python flask app and runs itupload_docker.sh
tags and uploads the created docker image to Docker Hubrun_kubernetes.sh
fetches the docker image from Docker Hub and runs it with Kubernetes
- Create a virtualenv and activate it
- Run
make install
to install the necessary dependencies
- Standalone:
python app.py
- Run in Docker:
./run_docker.sh
- Run in Kubernetes (using image from Docker Hub):
./run_kubernetes.sh