Team Ai
Apppublic

yuvi-debug/dummy_render

sourceHugging Facemitupdated 2y agoView on Hugging Face
0likes
app.py35 linesDownload Raw Back to root
1import gradio as gr2 3with gr.Blocks() as demo1:4    show_box = gr.Checkbox()5 6    @gr.render(inputs=show_box)7    def render(show_box):8        if show_box:9            textbox = gr.Textbox()10            textbox2 = gr.Textbox()11            textbox.change(lambda x:x, textbox, textbox2)12        else:13            gr.Markdown("Hidden textbox")14 15#demo.launch(debug=True)16 17import gradio as gr18 19def predict(*args):20    print(args)21    return {"inputs": list(args)}22 23with gr.Blocks() as demo:    24    s = gr.Slider(1, 4, step=1, interactive=True)25 26    @gr.render(inputs=s, triggers=[s.change])27    def render(num):28        texts = []29        with gr.Row():30            for i in range(num):31               texts.append(gr.Textbox())32        json = gr.JSON()33        btn = gr.Button("RUN")34        btn.click(fn=predict, inputs=texts, outputs=json)35demo.launch(debug=True)