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.
- Standalone:
#Setup a python virtual environment and activate it
make setup
#Install the necessary dependencies
make install
#Run the main application
python app.py
- Run in Docker:
./run_docker.sh
- Run in Kubernetes:
./run_kubernetes.sh
The application will be running on http://localhost:8000
While the application is running, run ./make_predicion.sh
to make api calls to the app
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
- 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