This project is all about operationalizing a Machine Learning Microservice API app.py
—that serves out predictions (inference) about housing prices through API calls.
Using 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. The Data set is gotten from the data source site.
- Run
make setup
to setup python virtual environment. Just like below
python3 -m venv ~/.devops
# You should have Python 3.7 available in your host.
# Check the Python path using `which python3`
source .devops/bin/activate
- Run
make install
to install the necessary dependencies - Install hadolint with these commands
wget -O /bin/hadolint https://github.com/hadolint/hadolint/releases/download/v1.16.3/hadolint-Linux-x86_64 && chmod +x /bin/hadolint
. This will help lint Dockerfile. - Install docker using this link.
- Install minikube using this link. This will help to run Kubernetes locally.
- Run
make lint
to check the source and Dockerfile
- Run
python3 app.py
- Run
./run_docker.sh
then run./make_predicton.sh
to make predictions. - Run
./upload_docker.sh
to upload the docker image to docker hub.
- Run
./run_kubernetes.sh
then run./make_predicton.sh
to make predictions.
.
├── Dockerfile
├── Makefile
├── README.md
├── app.py
├── hadolint
├── make_prediction.sh
├── model_data
│ ├── boston_housing_prediction.joblib
│ └── housing.csv
├── output_txt_files
│ ├── docker_out.txt
│ └── kubernetes_out.txt
├── requirements.txt
├── run_docker.sh
├── run_kubernetes.sh
└── upload_docker.sh
.circleci/config.yml
contains the config file for cirleci for CI integration.output_txt_files
contains the prediction outputs for docker run and kubernates run aftermake_prediction.sh
script was run.app.py
contains the source code of the applicationDockerfile
contains the configuration for the docker container env. setupMakefile
basically contains the summary instruction on deploying the apprequirements.txt
contains the dependencies to install