Skip to Content
TissueLab Docs

Custom Models

Add your own model as a task node.

How a task node runs

Each model is a task node: a small HTTP service in its own conda environment, started and stopped by TissueLab.

  1. Register
    Node script + requirements
  2. Environment
    Conda env created for the node
  3. Start
    Launched on a free port
  4. Run
    /init → /read → /execute
  5. Results
    Written into the slide’s Zarr store

What a node implements

CallPurpose
POST /initLoad the model
POST /readReceive the job, including the path of the slide's Zarr store
POST /executeRun inference and write the results
GET /statusHealth check
GET /progressProgress as Server-Sent Events

A node writes into the group for its category, using the dataset names in Export Schema:

CategoryZarr group
NucleiSegCell-Segmentation
NucleiClassifyCell-Classification
TissueSegPatch-Segmentation
TissueClassifyPatch-Classification

Start from an existing node

Custom weights

  • Wrap your PyTorch model in a node: load the weights in /init, run it in /execute.
  • A foundation model such as H-optimus-0 fits NucleiSeg (per-cell embeddings) or TissueSeg (per-patch embeddings).
  • Your script decides where its weights live. The service starts it from the script's own folder, so paths relative to the script work.

Register a node

Nodes can be registered in the app, or through the service API:

curl -X POST http://127.0.0.1:5001/api/tasks/v1/register_custom_node \
  -H "Content-Type: application/json" \
  -d '{
    "model_name": "MyEmbedding",
    "factory": "TissueSeg",
    "python_version": "3.11",
    "service_path": "/path/to/my_embedding_tasknode.py",
    "dependency_path": "/path/to/requirements.txt"
  }'

The full API reference is served by your own instance at http://127.0.0.1:5001/api/v1/docs.

On this page