Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
ML Model Deployment: Flask, FastAPI, Docker, Kubernetes
New
1 students

ML Model Deployment: Flask, FastAPI, Docker, Kubernetes

Serve models in production: Flask and FastAPI, containers, Kubernetes, autoscaling and the failure modes of each.
Created byReal Numbers
Last updated 10/2026
English
English

What you'll learn

  • Take a pickled model out of a notebook and serve it over HTTP with input validation, a health route and a version route a product team can rely on
  • Build the same service in Flask and FastAPI, explain WSGI versus ASGI as a mechanism, and say honestly which one a given service should use
  • Run a load test that means something: hold the payload constant, discard the warm-up, find the knee, and know why a closed-loop generator flatters you
  • Containerise the service so the image actually caches, then deploy it with Deployments, Services, ingress, readiness probes and horizontal autoscaling
  • Set resource requests and limits deliberately, diagnose an OOMKilled pod that left no application log, and explain why CPU throttles where memory kills
  • Reverse a bad release under pressure: code and model artefact together, and recognise the schema change that makes rollback impossible

Course content

10 sections • 51 lectures • 7h 39m total length
  • Welcome, and how to use this course4:02

    How the course is structured, what you need installed, how the hands-on lectures work, and how to get the most out of it.

Requirements

  • You can write working Python and have trained a model at some point. Deep ML knowledge is not needed - the model arrives already fitted
  • Comfort at a command line. You will run processes, build images and apply manifests rather than clicking through portals
  • A laptop that runs Python and Docker, plus a local cluster from kind or minikube. CPU-only and offline except one marked serverless lecture
  • No prior experience of containers, Kubernetes, gunicorn, nginx or FastAPI. All of them are built up from the primitive

Description

This course contains the use of artificial intelligence.

You can fit a model. You have never been on call. That is the gap this course is for.

Almost every deployment tutorial ends at the same place: the endpoint returns a prediction, the terminal shows some JSON, and the lesson stops. Everything expensive happens after that moment. This course keeps going. What the service does when real demand arrives. What OOMKilled means, why your pod died at three in the morning with no application log, and where the evidence actually is. Why your image rebuilds from scratch every single time because of one misplaced line in a Dockerfile. What a cold start costs you and how to live with it. And what you do in the twenty minutes after you realise the new version is worse than the old one.

You deploy one model the whole way through: a small-business loan approval model, 12 features, trained on a seeded synthetic extract of 24,000 rows. It is invented, and so is the lender - no real organisation appears here as a case study. It scores 75.03% on held-out data against a 73.0% approval rate, which makes it a weak model, deliberately. A weak model deploys exactly like a strong one, and the deployment is the subject. A megabyte and a half of training data collapses into a 1,440-byte pickle, or 1,225 bytes as joblib, 14.93% smaller. The whole course is about moving that artefact around correctly.

It teaches Flask and FastAPI, in that order, and takes a position on both. You build the Flask service, put gunicorn and nginx in front of it, and find out what workers and threads actually do. Then WSGI versus ASGI as a mechanism rather than a slogan: what an event loop buys you, what transfers unchanged, the four things that change in the code, typed requests with Pydantic and the documentation you get free. And then the lecture most courses skip - scoring a model is CPU-bound, it never awaits, and writing async def around it does not make it faster. It can make it worse, because one blocking call inside a coroutine stalls the loop for every concurrent request. Flask is still the right answer for some services, and the course says which.

Then containers, properly: layers, caching, image size, Compose for local multi-service testing, registries and how an image gets promoted rather than rebuilt. Then Kubernetes as an object model instead of a console - what a Deployment is, what a Service does, what ingress is for, how horizontal autoscaling behaves under load, what requests and limits talk to, and why a rolling update with no readiness probe is a confident way to serve errors.

There is one thing this course refuses to give you, and it refuses on principle. No latency figure. No requests per second. No worker count that is correct. No cold-start duration. Those are properties of a machine, a kernel and a Python build, and a course that publishes its own tail latency as a fact is publishing a fact about somebody else's laptop. You get the shapes instead - what a histogram looks like when you are queueing rather than computing, where the knee in a throughput curve is - the method that makes a run defensible, and a lab that prints your numbers on your hardware. That argument is made explicitly, once, in Section 3. It is a credibility moment, not an apology.

Nothing walks a UI. Menus get renamed and buttons move; manifests, command lines and object models have been stable for years, and that is what gets taught. Where a managed product is named, it is named as an example of a category and the category's cost is stated.

The capstone ships the same artefact three ways - a container, a cluster deployment and a serverless runtime - against identical acceptance criteria, and compares them on reversibility and operational load rather than on a benchmark.

Who this course is for:

  • Data scientists whose models work in a notebook and have never been called by anything other than themselves
  • Python developers asked to put a model behind an API who want the shape of a serving system, not a tour of a cloud console
  • Engineers surprised by a model service already: the pod that died silently, the image that never caches, the release nobody could reverse
  • Anyone about to go on call for an inference service, who would rather meet the failure modes in a lab than at three in the morning