In order to operationalize a Machine Learning Microservice API for this project, I used the skills I learned in the course.
You are given 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. This project tests your ability to operationalize a Python flask app—in a provided file, app.py
—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.
- Invoke a Docker container
- Place the container in a public registry (hub.docker.com)
- Utilize a Kubernetes cluster to run the deployed application.
- Use CircleCI to integrate for continuous integration.
- Most things are terminal commands and
- long commands has been moved to shell script file whith
.sh
extension. - Examples:
run_docker.sh
make_prediction.sh
which contain acurl
command that can make a POST request to local instance of the app send along json data to be used for the predictionMakefile
with no extension, is a special file, containing shell commands.
- clone the repo:
git clone [email protected]:ezehlivinus/udapeople-project4-demo.git
- navigate to the project directory:
cd git clone udapeople-project4-demo
- setup the environment:
- On your terminal run:
make setup
- On your terminal run:
- Install dependencies using
make
by running the following on your terminalmake setup
- You may lint:
make lint
- Run the application using docker:
./run_docker.sh
You can do this with the script file ./upload_docker.sh
.
we make an environment to keep our username and desired image.
- Locate the following line of code in the script:
dockerpath=ezehlivinus/udapeople
- Chnage
ezehlivinus
to your docker hub username - Change
udapeople
to your prefered image name - In essence: the code syntax is:
dockerpath=your-docker-hub-username/image-name
- If you changed the user and the image name
- You may want to do the same by changing the same code on this file:
./run_kubernetes.sh
as you will be using next
- You may want to do the same by changing the same code on this file:
The script file ./run_kubernetes.sh
contain the code run the deployment to kubernetes
- Note: deploy as your own project,
- Run the following command to deploy:
./run_kubernetes.sh