Skip to content

Conversation

@engmohamedsalah
Copy link
Contributor

This tutorial demonstrates how to deploy MONAI model bundles as production-ready REST APIs using FastAPI.

Features:

  • Complete FastAPI application with inference endpoints
  • MONAI model bundle integration (spleen_ct_segmentation)
  • Singleton pattern for efficient model loading
  • Async/await for optimal performance
  • Pydantic validation for type safety
  • Auto-generated API documentation (Swagger/ReDoc)
  • Docker deployment with multi-stage builds
  • Comprehensive unit tests
  • Example client code and HTTP requests
  • Production-ready error handling and logging

Structure:

  • app/: FastAPI application code
  • tests/: Unit test suite
  • docker/: Containerization configs
  • examples/: Usage examples
  • README.md: Complete tutorial documentation

Addresses #2048

Fixes # .

Description

A few sentences describing the changes proposed in this pull request.

Checks

  • Avoid including large-size files in the PR.
  • Clean up long text outputs from code cells in the notebook.
  • For security purposes, please check the contents and remove any sensitive info such as user names and private key.
  • Ensure (1) hyperlinks and markdown anchors are working (2) use relative paths for tutorial repo files (3) put figure and graphs in the ./figure folder
  • Notebook runs automatically ./runner.sh -t <path to .ipynb file>

engmohamedsalah and others added 2 commits December 3, 2025 18:33
This tutorial demonstrates how to deploy MONAI model bundles as
production-ready REST APIs using FastAPI.

Features:
- Complete FastAPI application with inference endpoints
- MONAI model bundle integration (spleen_ct_segmentation)
- Singleton pattern for efficient model loading
- Async/await for optimal performance
- Pydantic validation for type safety
- Auto-generated API documentation (Swagger/ReDoc)
- Docker deployment with multi-stage builds
- Comprehensive unit tests
- Example client code and HTTP requests
- Production-ready error handling and logging

Structure:
- app/: FastAPI application code
- tests/: Unit test suite
- docker/: Containerization configs
- examples/: Usage examples
- README.md: Complete tutorial documentation

Addresses Project-MONAI#2048

Signed-off-by: Mohamed Salah <eng.mohamed.tawab@gmail.com>
Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @engmohamedsalah thanks for this tutorial on deployment (sorry for not responding to your original issue proposing this). I think this looks great as it is so we can hopefully merge this soon. We have automated testing for notebooks which this example doesn't use so we won't be tested regularly, we may want to return sometime later to see if we can integrate the tests into the CICD system.

@ericspod ericspod enabled auto-merge (squash) December 4, 2025 19:51
@ericspod ericspod merged commit d6da454 into Project-MONAI:main Dec 4, 2025
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants