Skip to main content
Version: Next

Function: useStyleTransfer()

useStyleTransfer(config, options?): object

Defined in: hooks/useStyleTransfer.ts:22

React hook to load and run an image style transfer model.

This hook manages downloading (if remote URLs are provided) and loading the model assets, compiling them, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.

For imperative usage, see createStyleTransfer.

Parameters​

config​

StyleTransferModel

The style transfer model configuration. See StyleTransferModel.

options?​

ResourceOptions

Load and caching options. See ResourceOptions.

Returns​

object

The same object as StyleTransfer (without dispose), combined with loading state and download progress.

downloadProgress​

downloadProgress: any

error​

error: any

isReady​

isReady: boolean = !!model

resource​

resource: any

transferStyle​

transferStyle: any = model.transferStyle

transferStyleWorklet​

transferStyleWorklet: any = model.transferStyleWorklet

See​

StyleTransfer