Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
with gr.Blocks() as
|
| 4 |
show_box = gr.Checkbox()
|
| 5 |
|
| 6 |
@gr.render(inputs=show_box)
|
|
@@ -12,4 +12,21 @@ with gr.Blocks() as demo:
|
|
| 12 |
else:
|
| 13 |
gr.Markdown("Hidden textbox")
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
demo.launch(debug=True)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
with gr.Blocks() as demo1:
|
| 4 |
show_box = gr.Checkbox()
|
| 5 |
|
| 6 |
@gr.render(inputs=show_box)
|
|
|
|
| 12 |
else:
|
| 13 |
gr.Markdown("Hidden textbox")
|
| 14 |
|
| 15 |
+
#demo.launch(debug=True)
|
| 16 |
+
|
| 17 |
+
def predict(a):
|
| 18 |
+
print(a)
|
| 19 |
+
return {"inputs": a}
|
| 20 |
+
with gr.Blocks() as demo:
|
| 21 |
+
s = gr.Slider(1, 4, step=1, interactive=True)
|
| 22 |
+
|
| 23 |
+
@gr.render(inputs=s, triggers=[s.change])
|
| 24 |
+
def render(num):
|
| 25 |
+
texts = []
|
| 26 |
+
with gr.Row():
|
| 27 |
+
for i in range(num):
|
| 28 |
+
texts.append(gr.Textbox())
|
| 29 |
+
json = gr.JSON()
|
| 30 |
+
btn = gr.Button("RUN")
|
| 31 |
+
btn.click(fn=predict, inputs=texts, outputs=json)
|
| 32 |
demo.launch(debug=True)
|