Build Custom Widget

Development

Example

Reference code:

https://github.com/wl-zhao/proconfig-diffuser-imagen

The code above provides a simple example of calling the DiffusionPipeline in diffusers. The core code is in:

https://github.com/wl-zhao/proconfig-diffuser-imagen/blob/main/diffuser_widget.py

Development Process

  1. Define the widget's name and category through NAME and CATEGORY.

  2. Define input and output specifications via InputsSchema and OutputsSchema. Use pydantic syntax to define the schema for each field.

  3. Implement the execute function to define the widget's actual execution logic. The function's inputs and outputs need to meet the previously defined input and output specifications.

  4. In the root directory, define __init__.py (e.g., https://github.com/wl-zhao/proconfig-diffuser-imagen/blob/main/init.py), and import the written widget inside.

Usage

You can install it via Install from Git in the Manager.

Last updated