Skip to main content
Three steps: deploy a model, connect the Bioptimus SDK, and run your first inference.
Not sure which model? M-Optimus-1 predicts spatial gene expression and also produces embeddings; H-Optimus-1 is the lighter, feature-only model. See M-Optimus and H-Optimus.

1. Deploy your model

Deploy on the platform that fits your use case — each guide has the full steps:
PlatformBest forGuide
AWS & SageMakerProduction pipelines and scaleDeploy →
On-premiseData residency, air-gapped sitesDeploy →
Hugging FaceNon-commercial academic, H-Optimus onlyLoad weights →
We recommend a real-time endpoint on ml.g5.xlarge (or the on-premise container) — the models are compiled for that GPU architecture (NVIDIA A10G, CUDA Compute Capability 8.6).

2. Connect the Bioptimus SDK

Point the Bioptimus SDK at your deployment (use Models.H1 or Models.M_OPTIMUS):
from bioptimus.models.backbones import Backbone
from bioptimus.models.types import Models

model = Backbone(Models.M_OPTIMUS, backend="remote", base_url="http://localhost:8080")
from bioptimus.models.backbones import Backbone
from bioptimus.models.types import Models

model = Backbone(Models.M_OPTIMUS, backend="aws",
                 endpoint_name="m-optimus", region_name="us-east-1")
Academic (Hugging Face) users load H-Optimus-1 directly with timm instead of the Bioptimus SDK — see Hugging Face.

3. Get your first embedding

Send a single 224×224 tile through the connected model to confirm the full path works:
import numpy as np
from PIL import Image
from bioptimus.inference.schemas import ModelRequest

# Replace the blank tile with a real 224×224 H&E tile at 0.5 µm/px.
tile = Image.fromarray(np.zeros((224, 224, 3), dtype=np.uint8))
request = ModelRequest(image_data=tile, slide_name="demo",
                       x=0, y=0, width=224, height=224, patch_idx=0)

response = model.embed(request)
print(len(response.output))   # 1536
import numpy as np
from PIL import Image
from bioptimus.inference.schemas import ModelRequest

# Replace the blank tile with a real 224×224 H&E tile at 0.5 µm/px.
tile = Image.fromarray(np.zeros((224, 224, 3), dtype=np.uint8))
request = ModelRequest(image_data=tile, slide_name="demo",
                       x=0, y=0, width=224, height=224, patch_idx=0)

response = model.predict(request)   # spatial gene expression for the tile
print(len(response.output))         # one value per output gene
For whole-slide inference — tiling, tissue masking, and writing results — see the Bioptimus SDK.

Next steps

Bioptimus SDK

Whole-slide inference: tiling, tissue masking, bulk RNA, and output formats.

Runnable notebooks

End-to-end examples: h1-jumpstart (H-Optimus) and m-jumpstart (M-Optimus).