hysts HF staff commited on
Commit
13ab90d
·
1 Parent(s): b8b0688
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -2,8 +2,20 @@
2
 
3
  import gradio as gr
4
 
 
 
 
 
 
 
 
 
 
 
 
5
  with gr.Blocks() as demo:
6
- pass
 
7
 
8
  if __name__ == "__main__":
9
  demo.queue().launch()
 
2
 
3
  import gradio as gr
4
 
5
+ CHOICES = ["(NONE)", "a", "b", "c"]
6
+
7
+
8
+ def fn(choices):
9
+ print(choices)
10
+ if "(NONE)" in choices:
11
+ return []
12
+ else:
13
+ return choices
14
+
15
+
16
  with gr.Blocks() as demo:
17
+ checkbox = gr.CheckboxGroup(choices=CHOICES, value=["a", "b", "c"])
18
+ checkbox.change(fn=fn, inputs=checkbox, outputs=checkbox)
19
 
20
  if __name__ == "__main__":
21
  demo.queue().launch()