abidlabs's picture
abidlabs HF Staff
Create app.py
cc3d8be
raw
history blame contribute delete
558 Bytes
import gradio as gr
max_textboxes = 10
def variable_outputs(k):
k = int(k)
return [gr.Textbox.update(visible=True)]*k + [gr.Textbox.update(visible=False)]*(max_textboxes-k)
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
s = gr.Slider(1, max_textboxes, step=1)
with gr.Column():
textboxes = []
for i in range(max_textboxes):
t = gr.Textbox(f"Textbox {i}")
textboxes.append(t)
s.change(variable_outputs, s, textboxes)
demo.launch()