mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-17 11:29:58 +08:00
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:
parent
f18e317419
commit
83cde9b9e3
File diff suppressed because one or more lines are too long
@ -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)
|
||||
|
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user