Creating MedNIST Classifier App

This tutorial demos the process of packaging up a trained model using MONAI Deploy App SDK into an artifact which can be run as a local program performing inference, a workflow job doing the same, and a Docker containerized workflow execution.


# Create a virtual environment with Python 3.7.
# Skip if you are already in a virtual environment.
# (JupyterLab dropped its support for Python 3.6 since 2021-12-23.
#  See
conda create -n mednist python=3.7 pytorch jupyterlab cudatoolkit=11.1 -c pytorch -c conda-forge
conda activate mednist

# Launch JupyterLab if you want to work on Jupyter Notebook

Executing from Shell

# Clone the github project (the latest version of the main branch only)
git clone --branch main --depth 1

cd monai-deploy-app-sdk

# Install monai-deploy-app-sdk package
pip install monai-deploy-app-sdk

# Download/Extract from

# Download
pip install gdown

# After downloading from the web browser or using gdown,
unzip -o

# Install necessary packages from the app
pip install monai Pillow

# Local execution of the app
python examples/apps/mednist_classifier_monaideploy/ -i input/AbdomenCT_007000.jpeg -o output -m

# Package app (creating MAP docker image) using `-l DEBUG` option to see progress.
# This assumes that nvidia docker is installed in the local machine.
# Please see to install nvidia-docker2.
monai-deploy package examples/apps/mednist_classifier_monaideploy/ \
    --tag mednist_app:latest \
    --model \
    -l DEBUG

# Run the app with docker image and input file locally
monai-deploy run mednist_app:latest input output
cat output/output.json