Spaces:
Sleeping
Sleeping
File size: 863 Bytes
8fdc208 d238dbe 8fdc208 a64b5fc 8fdc208 d238dbe cfdaab7 ba33199 cfdaab7 d238dbe cfdaab7 d238dbe 8fdc208 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
with gr.Blocks() as demo1:
show_box = gr.Checkbox()
@gr.render(inputs=show_box)
def render(show_box):
if show_box:
textbox = gr.Textbox()
textbox2 = gr.Textbox()
textbox.change(lambda x:x, textbox, textbox2)
else:
gr.Markdown("Hidden textbox")
#demo.launch(debug=True)
import gradio as gr
def predict(*args):
print(args)
return {"inputs": list(args)}
with gr.Blocks() as demo:
s = gr.Slider(1, 4, step=1, interactive=True)
@gr.render(inputs=s, triggers=[s.change])
def render(num):
texts = []
with gr.Row():
for i in range(num):
texts.append(gr.Textbox())
json = gr.JSON()
btn = gr.Button("RUN")
btn.click(fn=predict, inputs=texts, outputs=json)
demo.launch(debug=True) |