Fix run on click (#4258)

* fix run on click

* changelog
This commit is contained in:
Abubakar Abid 2023-05-17 23:05:47 +02:00 committed by GitHub
parent 810cff7922
commit f353adf7a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -4,7 +4,7 @@ No changes to highlight.
## Bug Fixes:
No changes to highlight.
- Fixed the behavior of the `run_on_click` parameter in `gr.Examples` by [@abidlabs](https://github.com/abidlabs) in [PR 4258](https://github.com/gradio-app/gradio/pull/4258).
## Other Changes:

View File

@ -256,7 +256,7 @@ class Examples:
targets = self.inputs_with_examples + self.outputs
else:
targets = self.inputs_with_examples
self.dataset.click(
load_input_event = self.dataset.click(
load_example,
inputs=[self.dataset],
outputs=targets, # type: ignore
@ -267,7 +267,7 @@ class Examples:
if self.run_on_click and not self.cache_examples:
if self.fn is None:
raise ValueError("Cannot run_on_click if no function is provided")
self.dataset.click(
load_input_event.then(
self.fn,
inputs=self.inputs, # type: ignore
outputs=self.outputs, # type: ignore
@ -522,7 +522,6 @@ class Progress(Iterable):
def create_tracker(root_blocks, event_id, fn, track_tqdm):
progress = Progress(_callback=root_blocks._queue.set_progress, _event_id=event_id)
if not track_tqdm:
return progress, fn