Making predictions in a GUI environment
Welcome to the last section of the book. This section will tie our simple web application to an already-deployed machine learning API. This closely resembles a production environment, where you have one or more machine learning models deployed, and the application development team wants to use them in their application. The only difference is that you're both the data science and application development team.
Once again, we'll have to make a couple of changes to the application structure:
- Let's start with the simpler part. Inside the root directory, create a Python file called
predictor.py
. This file will hold a single function that implements the logic discussed at the beginning of this chapter when we made predictions in the notebook environment.Put simply, this function has to make a POST request to the API and return a response in JSON format.
Here's the entire code snippet for the file:
import os import json...