SageMaker dispatch endpoint
curl --request POST \
--url http://localhost:8080/invocations \
--header 'Content-Type: application/json' \
--data '
{
"model_name": "h1",
"mode": "embedding",
"image_data": "<base64>",
"slide_name": "slide_A",
"x": 0,
"y": 0,
"width": 224,
"height": 224,
"patch_idx": 0
}
'import requests
url = "http://localhost:8080/invocations"
payload = {
"model_name": "h1",
"mode": "embedding",
"image_data": "<base64>",
"slide_name": "slide_A",
"x": 0,
"y": 0,
"width": 224,
"height": 224,
"patch_idx": 0
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model_name: 'h1',
mode: 'embedding',
image_data: '<base64>',
slide_name: 'slide_A',
x: 0,
y: 0,
width: 224,
height: 224,
patch_idx: 0
})
};
fetch('http://localhost:8080/invocations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/invocations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_name' => 'h1',
'mode' => 'embedding',
'image_data' => '<base64>',
'slide_name' => 'slide_A',
'x' => 0,
'y' => 0,
'width' => 224,
'height' => 224,
'patch_idx' => 0
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/invocations"
payload := strings.NewReader("{\n \"model_name\": \"h1\",\n \"mode\": \"embedding\",\n \"image_data\": \"<base64>\",\n \"slide_name\": \"slide_A\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 224,\n \"height\": 224,\n \"patch_idx\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/invocations")
.header("Content-Type", "application/json")
.body("{\n \"model_name\": \"h1\",\n \"mode\": \"embedding\",\n \"image_data\": \"<base64>\",\n \"slide_name\": \"slide_A\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 224,\n \"height\": 224,\n \"patch_idx\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/invocations")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_name\": \"h1\",\n \"mode\": \"embedding\",\n \"image_data\": \"<base64>\",\n \"slide_name\": \"slide_A\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 224,\n \"height\": 224,\n \"patch_idx\": 0\n}"
response = http.request(request)
puts response.read_body{
"output": [
123
],
"slide_name": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123,
"tissue_ratio": 123,
"patch_idx": 123,
"resolution": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Internal server error"
}{
"status": "loading"
}Service
SageMaker dispatch endpoint
SageMaker-compatible endpoint. Accepts a SageMakerRequest (ModelRequest plus model_name and mode) to route to the correct model and mode. Used by the SDK’s AWS backend.
POST
/
invocations
SageMaker dispatch endpoint
curl --request POST \
--url http://localhost:8080/invocations \
--header 'Content-Type: application/json' \
--data '
{
"model_name": "h1",
"mode": "embedding",
"image_data": "<base64>",
"slide_name": "slide_A",
"x": 0,
"y": 0,
"width": 224,
"height": 224,
"patch_idx": 0
}
'import requests
url = "http://localhost:8080/invocations"
payload = {
"model_name": "h1",
"mode": "embedding",
"image_data": "<base64>",
"slide_name": "slide_A",
"x": 0,
"y": 0,
"width": 224,
"height": 224,
"patch_idx": 0
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model_name: 'h1',
mode: 'embedding',
image_data: '<base64>',
slide_name: 'slide_A',
x: 0,
y: 0,
width: 224,
height: 224,
patch_idx: 0
})
};
fetch('http://localhost:8080/invocations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/invocations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_name' => 'h1',
'mode' => 'embedding',
'image_data' => '<base64>',
'slide_name' => 'slide_A',
'x' => 0,
'y' => 0,
'width' => 224,
'height' => 224,
'patch_idx' => 0
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/invocations"
payload := strings.NewReader("{\n \"model_name\": \"h1\",\n \"mode\": \"embedding\",\n \"image_data\": \"<base64>\",\n \"slide_name\": \"slide_A\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 224,\n \"height\": 224,\n \"patch_idx\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/invocations")
.header("Content-Type", "application/json")
.body("{\n \"model_name\": \"h1\",\n \"mode\": \"embedding\",\n \"image_data\": \"<base64>\",\n \"slide_name\": \"slide_A\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 224,\n \"height\": 224,\n \"patch_idx\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/invocations")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_name\": \"h1\",\n \"mode\": \"embedding\",\n \"image_data\": \"<base64>\",\n \"slide_name\": \"slide_A\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 224,\n \"height\": 224,\n \"patch_idx\": 0\n}"
response = http.request(request)
puts response.read_body{
"output": [
123
],
"slide_name": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123,
"tissue_ratio": 123,
"patch_idx": 123,
"resolution": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Internal server error"
}{
"status": "loading"
}Body
application/json
Base64-encoded PNG tile. (The SDK also accepts a PIL Image or raw bytes.)
Stem of the source slide filename.
Tile x-coordinate in the slide.
Tile y-coordinate in the slide.
Tile width in pixels.
Tile height in pixels.
Index of this tile in the extraction plan.
Target model.
Available options:
h1, m-optimus, tissue-seg Dispatch mode.
Available options:
embedding, prediction, metadata Optional bulk RNA counts vector (M-Optimus prediction only).
Fraction of tissue in the tile.
Extraction resolution in microns per pixel.

