Skip to main content
Version: Next

Function: useTextToImage()

useTextToImage(config, options?): object

Defined in: hooks/useTextToImage.ts:24

React hook to load and run an SDXS text-to-image synthesis model.

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

For imperative usage, see createSdxsTextToImage.

Parameters​

config​

SdxsTextToImageModel

The SDXS model configuration. See SdxsTextToImageModel.

options?​

ResourceOptions

Load and caching options. See ResourceOptions.

Returns​

object

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

downloadProgress​

downloadProgress: any

error​

error: any

generate​

generate: any = model.generate

generateWorklet​

generateWorklet: any = model.generateWorklet

isReady​

isReady: boolean = !!model

resource​

resource: any

See​

SdxsTextToImage