Project 9 of 10

Model API with FastAPI & Docker

Lessons

About This Project

A model sitting in a notebook is not useful to anyone else. To make it usable, you wrap it in an API: a small web service that accepts input over HTTP and returns the model's prediction. FastAPI is a popular Python framework for this because it is fast, validates inputs for you and generates interactive documentation automatically.

The lessons start with writing a FastAPI application that serves predictions from a simple model, followed by a practical tutorial on serving ML models. Then you learn Docker fundamentals: images, containers and running an app the same way on any machine. The last lesson puts it together by deploying an ML model with FastAPI and Docker.

Watch the lessons in order and code along locally. Install Docker Desktop first, and reuse a model you trained in an earlier project (saved with joblib or pickle) so you can focus on the API and container. The final video deploys to Heroku, which no longer has a free tier, so treat that part as a concept and deploy to any platform you prefer, or just run the container locally.

Lessons

4 videos
01

Serving a Machine Learning Model: Writing a FastAPI Application

Develop a FastAPI application that serves the predictions of a simple ML model through HTTP requests.

Video 53min
02

Serve ML Models with FastAPI: Practical Tutorial

A hands-on tutorial on building a FastAPI app to serve machine learning models.

Video 15min
03

Learn Docker in 7 Easy Steps: Full Beginner Tutorial

A complete introduction to Docker: containerize an app and manage multiple containers with Docker Compose.

Video 11min
04

Deploy ML Models with FastAPI, Docker, and Heroku

Put it all together: wrap a model in a FastAPI app, package it in a Docker container and deploy it.

Video 18min