Deploying the Model
It is now time to deploy our machine learning model as a REST API. First, however, you need to install the Flask micro‐framework.
Type the following in Terminal or Command Prompt to install Flask:
$ pip install flask
Once Flask is installed, create a text file named
, and enter the following code snippet:REST_API.py
import pickle
from flask import Flask, request, json, jsonify
import numpy as np
app = Flask(__name__)
#---the filename of the saved model---
filename = 'diabetes.sav'
#---load the saved model---
loaded_model = pickle.load(open(filename, 'rb'))
@app...