Skip to main content
Version: 0.11.x

Function: createInpainter()

createInpainter(config, runtime?): Promise<Inpainter>

Defined in: extensions/cv/tasks/inpainting.ts:126

Creates an image inpainting runner for executing local inpainting models.

It validates the model inputs and outputs requirements, pre-allocates the necessary static execution tensors, and registers clean disposal hooks to clear all native memory. The model is expected to take an RGB image in [0, 1] and a mask with 1 for known pixels and 0 for the hole, and to return the filled RGB image in [0, 1], all at a fixed resolution.

Parameters​

config​

InpainterModel

Inpainting task configuration containing path and options. See InpainterModel.

runtime?​

WorkletRuntime

Optional worklet runtime thread on which to run the model execution.

Returns​

Promise<Inpainter>

A promise resolving to the instantiated Inpainter runner.

Throws​

With code LOAD_FAILED if model fails to load, or SCHEMA_MISMATCH if model schema does not match the inpainting spec.