In this project, you will need to create three files for testing the predictor web service and one file to scale it to production. First create app.py for our web server, requirements.txt for the dependencies, and the XGBoost model you downloaded from mlflow. These files will allow you to test the web service. Next, to put it into production you will need to dockerize the application. Dockerizing the file allow you to deploy it to services such as cloud-based web application or Kubernetes services. These services scale easily making onboarding new IoT devices seamless. Then execute the following steps:
- The app.py file is the Flask application. Import Flask for the web service, os and pickle for reading the model into memory, pandas for data manipulation, and xgboost to run our model:
from flask import Flask, request, jsonify
import os
import pickle
import pandas as pd
import xgboost as xgb
- Next is to initialize our variables. By loading the Flask application...