Skip to main content
Version: 0.10.0

Function: createStyleTransfer()

createStyleTransfer(config, runtime?): Promise<StyleTransfer>

Defined in: extensions/cv/tasks/styleTransfer.ts:93

Creates an image style transfer runner for executing local style transfer models.

It validates the model inputs and outputs requirements, pre-allocates the necessary static execution tensors, sets up an image preprocessor, and registers clean disposal hooks to clear all native memory.

Parameters

config

StyleTransferModel

Style transfer task configuration containing path and options. See StyleTransferModel.

runtime?

any

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

Returns

Promise<StyleTransfer>

A promise resolving to the instantiated StyleTransfer runner.

Throws

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