ML Model Deployment Patterns: From Flask to ONNX
Learn practical deployment patterns for ML models including Flask and FastAPI serving, ONNX export, and batch vs real-time inference architectures.
33 posts · page 1 of 1
Learn practical deployment patterns for ML models including Flask and FastAPI serving, ONNX export, and batch vs real-time inference architectures.
Learn Pydantic v2 for data validation, serialization, and settings management in Python. Covers models, validators, computed fields, and BaseSettings.
Compare FastAPI, Django, and Flask for Python web development. Understand performance, features, and ecosystem differences to choose the right framework.
Learn to run background tasks in FastAPI using built-in BackgroundTasks and scale with Celery for distributed job processing.
Build custom FastAPI middleware for request logging, CORS handling, authentication checks, and performance monitoring.
Master advanced FastAPI dependency injection with nested deps, class-based providers, yield dependencies, and shared state patterns.
Deploy FastAPI to production with Docker, Gunicorn, Uvicorn workers, health checks, multi-stage builds, and best practices.
Handle file uploads with validation, process large files with streaming, and serve dynamic streaming responses in FastAPI.
Protect your FastAPI endpoints from abuse with SlowAPI rate limiting using fixed window, sliding window, and token bucket strategies.
Set up async SQLAlchemy 2.0 with FastAPI for non-blocking database operations using asyncpg, async sessions, and proper patterns.
Build a robust test suite for FastAPI with TestClient, pytest fixtures, dependency overrides, and async testing patterns.
Build real-time features with FastAPI WebSockets including chat rooms, live notifications, and connection management patterns.
Deploy machine learning models as production REST APIs using FastAPI with input validation, async inference, and health checks.
Run work after the response: FastAPI BackgroundTasks, Celery integration, task queues, and when to use each approach for emails, webhooks, data processing, and more.
Master FastAPI's dependency injection system: Depends, sub-dependencies, database sessions, authentication, scoped dependencies, and testing with overrides.
How FastAPI's Depends system actually works, the lifecycle of dependencies, scoping with yield, and patterns for testable, layered FastAPI apps.
A practical comparison of DRF and FastAPI: performance, ORM, validation, async, and how to choose for a new Python service.
Implement JWT-based authentication in FastAPI with OAuth2 password flow, secure token signing, and a reusable get_current_user dependency.
When FastAPI BackgroundTasks are enough, when you need Celery, and how to wire jobs that survive crashes, retries, and scale.
Configure CORS in FastAPI without security holes: how the browser preflight works, which origins and headers to allow, credentials and cookies, and the most common misconfigurations to avoid.
Deploy FastAPI to production with Gunicorn managing Uvicorn workers. Cover process counts, timeouts, and health checks.
Learn how FastAPI middleware works under the hood and write your own for logging, timing, and request enrichment.
Tailor FastAPI's auto-generated OpenAPI schema: tags, summaries, examples, response models, custom operation IDs, security schemes, and a custom Swagger UI your team will actually use.
Master Pydantic models in FastAPI: type coercion, validators, nested models, settings, and tips for clean request and response schemas.
Add rate limiting to FastAPI using slowapi and Redis: token buckets vs fixed windows, per-user and per-IP limits, returning proper headers, and avoiding the most common production mistakes.
Compare SQLModel and raw SQLAlchemy for FastAPI projects and learn how to pick the right one for your team.
Stream large files, generated text, and Server-Sent Events from FastAPI without loading everything into memory.
Write fast, reliable tests for FastAPI apps using TestClient, pytest fixtures, dependency overrides, and a separate test database.
Build real-time features with FastAPI WebSockets. Manage connections, broadcast messages, and handle disconnects cleanly.
A practical guide to async path operations and Depends() in FastAPI — when async actually helps, per-request DB sessions, auth dependencies, and how sub-dependencies compose.
A practical guide to FastAPI with SQLAlchemy 2.0 — typed models with Mapped and mapped_column, sessionmaker, get_db dependency, CRUD endpoints, and where Alembic fits.
A practical guide to FastAPI routing and Pydantic v2 — path operations, path/query/body parameters, model validation, response_model, and response_model_exclude_unset.
A clear introduction to FastAPI — ASGI and Starlette, Pydantic-driven validation, automatic OpenAPI docs, async support, and how it compares to Flask and Django.