mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-17 11:29:58 +08:00
Respect interactive=True
in output of gr.Interface
(#4356)
* tests * changelog * lint * Update gradio/interface.py Co-authored-by: Aarni Koskela <akx@iki.fi> * format --------- Co-authored-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
parent
0a6a80ce02
commit
fc3bbca878
@ -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:
|
||||
|
@ -264,8 +264,10 @@ class Interface(Blocks):
|
||||
]:
|
||||
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)
|
||||
|
@ -160,6 +160,14 @@ class TestInterface:
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user