For the complete documentation index, see llms.txt. This page is also available as Markdown.

Running Inference

Files, streams, URLs, and image groups

endpoint.process() accepts a source and resolves to a ResultStream, an AsyncIterable of predictions.

This page is the Node call shapes. What a source is, every kind the platform accepts, and the options that shape how one is processed are covered once in Sources and Options.

Local files

const results = await endpoint.process({ source: { path: 'image.jpg' } })
for await (const result of results) {
    console.log(result)
}

Readable streams

Streams need an explicit MIME type.

import fs from 'node:fs'
import { Readable } from 'node:stream'

const stream = Readable.toWeb(fs.createReadStream('image.jpg'))
const results = await endpoint.process({
    source: { stream, mimeType: 'image/jpeg' },
})

Public URLs

A URL is fetched by the platform, so nothing uploads from your application. Source Types lists every scheme it accepts.

Image groups

A group is one source processed together as a single inference unit, returning one prediction for the whole set.

Image groups covers the size limit, the ordering guarantee, and which abilities accept a group.

Canceling jobs

Queued and in-progress jobs can be cancelled from the result iterator.

Camera calibration

process() and the group methods take a camera, which is what lets a depth map become positions in meters:

Set it once for every source with pop.defaults instead — see Composable Pops.

Next steps

Last updated