> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/developer-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/developer-documentation/sdks/node/inference.md).

# 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](/developer-documentation/platform/sources-and-options.md).

### Local files

```typescript
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.

```typescript
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](/developer-documentation/platform/sources-and-options/sources.md) lists every scheme it accepts.

```typescript
const results = await endpoint.process({
    source: { url: 'https://example.com/video.mp4' },
})
```

### Image groups

A [group](/developer-documentation/platform/sources-and-options/sources.md#image-groups) is one source processed together as a single inference unit, returning one prediction for the whole set.

```typescript
// local files
const fileGroupResults = await endpoint.uploadGroup(['a.jpg', 'b.jpg', 'c.jpg'])

// readable streams, with optional parallel MIME types
import fs from 'node:fs'
import { Readable } from 'node:stream'

const a = Readable.toWeb(fs.createReadStream('a.jpg'))
const b = Readable.toWeb(fs.createReadStream('b.jpg'))
const streamGroupResults = await endpoint.uploadStreamGroup([a, b], ['image/jpeg', 'image/jpeg'])

// remote URLs
const urlGroupResults = await endpoint.loadFromGroup([
    'https://example.com/a.jpg',
    'https://example.com/b.jpg',
])
```

[Image groups](/developer-documentation/platform/sources-and-options/sources.md#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.

```typescript
const results = await endpoint.process({
    source: { url: 'https://example.com/video.mp4' },
})

for await (const result of results) {
    console.log(result)
    if ((result.seconds ?? 0) >= 10) {
        results.cancel()
    }
}
```

### Camera calibration

`process()` and the group methods take a `camera`, which is what lets a [depth map](/developer-documentation/platform/depth-and-world-coordinates/depth-maps.md) become positions in meters:

```typescript
const results = await endpoint.process({
    source: { url: 'rtsp://camera.example.com/stream1' },
    camera: { hfovDegrees: 72 },
})
```

Set it once for every source with `pop.defaults` instead — see [Composable Pops](/developer-documentation/sdks/node/composable-pops.md#world-coordinates).

### Next steps

* [Sources and Options](/developer-documentation/platform/sources-and-options.md) — every source the platform accepts, and the options that shape processing
* [Composable Pops](/developer-documentation/sdks/node/composable-pops.md) — chain models into a pipeline
* [Visualization](/developer-documentation/sdks/node/visualization.md) — draw predictions on a canvas
* [Depth and World Coordinates](/developer-documentation/platform/depth-and-world-coordinates.md) — depth maps, calibration, and meters
