espnet3.publication.demo.assets.UIAsset
Less than 1 minute
espnet3.publication.demo.assets.UIAsset
class espnet3.publication.demo.assets.UIAsset
Bases: object
Base class for one demo UI asset type.
Demo configs refer to UI assets by ui.inputs[].type and ui.outputs[].type. Each asset implementation is responsible for building the corresponding Gradio component.
ESPnet3 developers can add new built-in assets by subclassing UIAsset and registering the subclass in DEFAULT_UI_ASSETS in this module.
Initialize one UI asset and cache the imported gradio module.
build_input(spec: dict[str, Any]) → Any
Build one input component for a demo spec.
- Parameters:spec – One resolved entry from
demo_config.ui.inputs. - Returns: Gradio component object for the input.
- Return type: Any
- Raises:ValueError – If the asset does not support input components.
build_output(spec: dict[str, Any]) → Any
Build one output component for a demo spec.
- Parameters:spec – One resolved entry from
demo_config.ui.outputs. - Returns: Gradio component object for the output.
- Return type: Any
- Raises:ValueError – If the asset does not support output components.
