Fix dataset demo (#5390)

* Fix as_example for ChecboxGroup

* add changeset

* add changeset

* Add code

* delete changeset

* Add ntoebook

* Exception

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Freddy Boulton 2023-09-05 11:47:10 -04:00 committed by GitHub
parent f18e317419
commit 83cde9b9e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -36,17 +36,17 @@ with gr.Blocks() as demo:
samples=[[True], [True], [False], [True], [False], [False]],
)
c_2 = gr.CheckboxGroup(visible=False)
c_2 = gr.CheckboxGroup(visible=False, choices=['a', 'b', 'c'])
gr.Dataset(
label="CheckboxGroup",
components=[c_2],
samples=[
[[True, True, False]],
[[True, True, False]],
[[True, True, False]],
[[True, True, False]],
[[True, True, False]],
[[True, True, False]],
[["a"]],
[["a", "b"]],
[["a", "b", "c"]],
[["b"]],
[["c"]],
[["a", "c"]],
],
)
c_3 = gr.ColorPicker(visible=False)

View File

@ -522,6 +522,8 @@ class TestCheckboxGroup:
cbox = gr.CheckboxGroup(choices=["a", "b"], value="c")
assert cbox.get_config()["value"] == ["c"]
assert cbox.postprocess("a") == ["a"]
with pytest.raises(ValueError):
gr.CheckboxGroup().as_example("a")
def test_in_interface(self):
"""