espnet3.demo.app_builder.build_demo_app
Less than 1 minute
espnet3.demo.app_builder.build_demo_app
espnet3.demo.app_builder.build_demo_app(demo_dir: Path) → Blocks
Build a Gradio demo app from a packaged demo directory.
The demo directory is expected to contain a demo.yaml (loaded via espnet3.demo.resolve.load_demo_config()) and any referenced assets such as an inference config (e.g., config/infer.yaml).
This function wires: : - UI components built from the demo config (or system defaults).
- A “Run” button that triggers
espnet3.demo.runtime.run_inference().
- Parameters:demo_dir (Path) – Path to the demo directory.
- Returns: A configured Gradio Blocks app instance.
- Return type: gr.Blocks
- Raises:
- ValueError – If the demo config does not define UI configuration and no supported system default UI is available.
- OSError – If required config files under
demo_dircannot be read.
Example
>>> from pathlib import Path
>>> import gradio as gr
>>> app = build_demo_app(Path("./demo"))
>>> isinstance(app, gr.Blocks)
TrueNotes
- If
demo.yamlprovidesui.article_path, it is read relative todemo_dir(unless an absolute path is provided).
