ARTICLE

Deploying Machine Learning Models, Part 2: model serving

From Machine Learning Bookcamp by Alexey Grigorev

Manning Publications
CodeX
Published in
8 min readAug 2, 2021

--

In this series, we cover model deployment: the process of putting models to use. In particular, we’ll see how to package a model inside a web service, allowing other services to use it. We also show how to deploy the web service to a production-ready environment.

Take 40% off Machine Learning Bookcamp by entering fccgrigorev into the discount code box at checkout at manning.com.

Check out part 1 if you missed it.

We already know how to load a trained model in a different process. Now we need to serve this model — make it available for others to use.

In practice, it usually means that a model is deployed as a web service, and other services can communicate with it, ask for predictions and use the results to make their own decisions.

In this article, we’ll see how to do it in Python with Flask — a Python framework for creating web services. First, we’ll take a look at why we need to use a web service for it.

Web services

We already know how to use a model to make a prediction, but this far, we hardcoded the features of a customer as a Python dictionary.

Let’s try to imagine how our model is used in practice.

--

--

Manning Publications
CodeX
Writer for

Follow Manning Publications on Medium for free content and exclusive discounts.