Skip to main content
Version: 0.11.x

Function: useInpainter()

useInpainter(config, options?): object

Defined in: hooks/useInpainter.ts:22

React hook to load and run an image inpainting 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 createInpainter.

Parameters​

config​

InpainterModel

The inpainting model configuration. See InpainterModel.

options?​

ResourceOptions

Load and caching options. See ResourceOptions.

Returns​

object

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

downloadProgress​

downloadProgress: number

error​

error: Error | undefined

inpaint​

inpaint: (image, mask) => Promise<ImageBuffer> | undefined = model.inpaint

inpaintWorklet​

inpaintWorklet: (image, mask) => ImageBuffer | undefined = model.inpaintWorklet

isReady​

isReady: boolean = !!model

resource​

resource: InpainterModel | undefined

See​

Inpainter