Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
max_textboxes = 10
|
4 |
+
|
5 |
+
def variable_outputs(k):
|
6 |
+
k = int(k)
|
7 |
+
return [gr.Textbox.update(visible=True)]*k + [gr.Textbox.update(visible=False)]*(max_textboxes-k)
|
8 |
+
|
9 |
+
with gr.Blocks() as demo:
|
10 |
+
with gr.Row():
|
11 |
+
with gr.Column():
|
12 |
+
s = gr.Slider(1, max_textboxes, step=1)
|
13 |
+
with gr.Column():
|
14 |
+
textboxes = []
|
15 |
+
for i in range(max_textboxes):
|
16 |
+
t = gr.Textbox(f"Textbox {i}")
|
17 |
+
textboxes.append(t)
|
18 |
+
|
19 |
+
s.change(variable_outputs, s, textboxes)
|
20 |
+
|
21 |
+
demo.launch()
|