Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have gr.on set value at start as well #9065

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradio/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def on(
for all events in the triggers list.

Parameters:
triggers: List of triggers to listen to, e.g. [btn.click, number.change]. If None, will listen to changes to any inputs.
triggers: List of triggers to listen to, e.g. [btn.click, number.change]. If None, will run on app load and changes to any inputs.
fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
Expand Down Expand Up @@ -646,7 +646,7 @@ def inner(*args, **kwargs):
[EventListenerMethod(input, "change") for input in inputs]
if inputs is not None
else []
) # type: ignore
) + [EventListenerMethod(root_block, "load")] # type: ignore
aliabid94 marked this conversation as resolved.
Show resolved Hide resolved
else:
methods = [
EventListenerMethod(t.__self__ if t.has_trigger else None, t.event_name) # type: ignore
Expand Down
Loading