diff --git a/CHANGELOG.md b/CHANGELOG.md index 36353b282a..28807404a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/gradio/helpers.py b/gradio/helpers.py index 7f0cb0e3da..873b80d22c 100644 --- a/gradio/helpers.py +++ b/gradio/helpers.py @@ -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