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

Respect interactive=True in output of gr.Interface #4356

Merged
merged 6 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

## New Features:

* Make `Blocks.load` behave like other event listeners (allows chaining `then` off of it) [@anentropic](https://github.com/anentropic/) in [PR 4304](https://github.com/gradio-app/gradio/pull/4304)

## Bug Fixes:

- Make `Blocks.load` behave like other event listeners (allows chaining `then` off of it) [@anentropic](https://github.com/anentropic/) in [PR 4304](https://github.com/gradio-app/gradio/pull/4304)
- Respect `interactive=True` in output components of a `gr.Interface` by [@abidlabs](https://github.com/abidlabs) in [PR 4356](https://github.com/gradio-app/gradio/pull/4356).
- Remove unused frontend code by [@akx](https://github.com/akx) in [PR 4275](https://github.com/gradio-app/gradio/pull/4275)

## Other Changes:
Expand Down
6 changes: 4 additions & 2 deletions gradio/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ def __init__(
]:
for o in self.output_components:
assert isinstance(o, IOComponent)
o.interactive = False # Force output components to be non-interactive

if o.interactive is None:
# Unless explicitly otherwise specified, force output components to
# be non-interactive
o.interactive = False
if (
interpretation is None
or isinstance(interpretation, list)
Expand Down
8 changes: 8 additions & 0 deletions test/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ def test_inline_display(self, mock_display):
assert mock_display.call_count == 2
interface.close()

def test_setting_interactive_false(self):
output_textbox = Textbox()
Interface(lambda x: x, "textbox", output_textbox)
assert not output_textbox.get_config()["interactive"]
output_textbox = Textbox(interactive=True)
Interface(lambda x: x, "textbox", output_textbox)
assert output_textbox.get_config()["interactive"]


class TestTabbedInterface:
def test_tabbed_interface_config_matches_manual_tab(self):
Expand Down