Flask & Deployment
Topic 11 · Shipping to production · ⏱ about 12 h

Project: Put Your Model Online

Ship a complete, portfolio-ready app: a Flask web page and JSON API around a trained model, with validation, tests, CI, Docker, a cloud deployment, monitoring and a clear README.

Show:
In this topic
Beginner

The brief

Take a model you trained in the Machine Learning course (or the no-show model from Serving a model) and make it usable by anyone with a browser:

  • a web page with a form that shows the prediction in plain language;
  • a JSON API (POST /api/v1/predict) with validation, batches and the model version in every response;
  • /health, structured logs and a simple drift report on the inputs received so far;
  • tests run by GitHub Actions on every push;
  • a Dockerfile and a live deployment with HTTPS and a budget alert.
Beginner

Milestones

  1. Model bundle: pipeline, version and feature list saved with joblib; a test that loads it and checks two known predictions.
  2. API: the /predict endpoint with validation; tests for good input, bad input and batches.
  3. Web page: a Jinja form using the same validation; friendly error messages; no unescaped user input.
  4. Container: Dockerfile with gunicorn and a non-root user; docker run works locally.
  5. CI: the GitHub Actions workflow runs pytest on every push.
  6. Deploy: to Render, Cloud Run, Fly.io or Hugging Face Spaces; environment variables set; health check on.
  7. Monitor: log each prediction (no personal data); a page or script that computes PSI on recent inputs.
Beginner

Make it count

Your README should have the live link, a screenshot, an architecture diagram (browser → Flask → model, with logs and CI), how to run it locally in two commands, the API documented with an example request, and what you would do next. A deployed, tested, monitored model is something many applicants for junior ML roles cannot show; see Portfolio Projects. To add an LLM feature, combine it with the Generative AI project.

Check yourself

Quiz

1. Which part of the brief catches a broken model before it is deployed?

2. Why should the web form and the API share the same validation code?

Go deeper

📚 Further reading

Trusted, mostly free sources: official documentation, well-known textbooks and courses. When you want to confirm or go deeper on anything here, start with these.

Ready