on
Parameters
Sequence[EventListenerCallable] | EventListenerCallable | None
default:"None"
List of triggers to listen to, e.g. [btn.click, number.change]. If None, will run on app load and changes to any inputs.
Callable | None
default:"None"
The function to call when this event is triggered.
Component | Sequence[Component] | None
default:"None"
List of gradio components to use as inputs.
Component | Sequence[Component] | None
default:"None"
List of gradio components to use as outputs.
Example
api
Parameters
Callable
required
The function to call when this event is triggered. The function should be fully typed, and the type hints will be used to derive the typing information for the API/MCP endpoint.
str | None
default:"None"
Defines how the endpoint appears in the API docs.
str | None
default:"None"
Description of the API endpoint.
bool
default:"True"
If True, will place the request on the queue.
bool
default:"False"
If True, then the function should process a batch of inputs.
int
default:"4"
Maximum number of inputs to batch together.
int | None | Literal['default']
default:"'default'"
If set, this is the maximum number of this event that can be running simultaneously.
str | None
default:"None"
If set, this is the id of the concurrency group.
Literal['public', 'private', 'undocumented']
default:"'public'"
Controls the visibility and accessibility of this endpoint.