[go: up one dir, main page]

Skip to content

Udactiy Cloud DevOps ND - Project-4- Microservices at Scale using AWS & Kubernetes

License

Notifications You must be signed in to change notification settings

mansong1/project-ml-microservice-kubernetes

Repository files navigation

CircleCI

Cloud DevOps Engineer Nanodegree - Operationalize a Machine Learning Microservice API

Overview

A containerised flask application 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. It utilises 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.


Running the application

  1. Standalone:
#Setup a python virtual environment and activate it
make setup

#Install the necessary dependencies
make install

#Run the main application
python app.py
  1. Run in Docker: ./run_docker.sh
  2. Run in Kubernetes: ./run_kubernetes.sh

The application will be running on http://localhost:8000

Predict housing prices

While the application is running, run ./make_predicion.sh to make api calls to the app

Upload Docker image to DockerHub

After running ./run_docker.sh, execute script./upload_docker.sh ${USERNAME} to upload image to DockerHub where ${USERNAME} is your dockerhub id. e.g. ./upload_docker.sh mansong


Project Files

  • app.py: The Flask application
  • requirements.txt: Prerequisites of Python packages for Flask app
  • model_data/boston_housing_prediction.joblib: Pretrained sklearn model used by the flask app
  • Dockerfile: Instructions of how to build our application container
  • Makefile: Commands to setup, install and lint the applicaiton
  • run_docker.sh: Builds and runs the docker container
  • run_kubernetes.sh: Runs Flask app as a pod in kubernetes
  • make_prediction.sh: Sends a POST api call to running Flask app to make a prediction
  • upload_docker.sh: Tags and uploads the Docker image to DockerHub
  • output_txt_files/docker_out.txt: Console output from running run_docker.sh and make_prediction.sh
  • output_txt_files/kubernetes_out.txt Console output from running run_kubernetes.sh and make_prediction.sh
  • .circleci/config.yml: Defines the circleCI deployment

About

Udactiy Cloud DevOps ND - Project-4- Microservices at Scale using AWS & Kubernetes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published