#!/usr/bin/env python | |
import gradio as gr | |
CHOICES = ["(NONE)", "a", "b", "c"] | |
def fn(choices): | |
print(choices) | |
if "(NONE)" in choices: | |
return [] | |
else: | |
return choices | |
with gr.Blocks() as demo: | |
checkbox = gr.CheckboxGroup(choices=CHOICES, value=["a", "b", "c"]) | |
checkbox.change(fn=fn, inputs=checkbox, outputs=checkbox) | |
if __name__ == "__main__": | |
demo.queue().launch() | |