yeter commited on
Commit
a5e3833
·
1 Parent(s): 47f5e20

Create test.py

Browse files
Files changed (1) hide show
  1. test.py +22 -0
test.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import time
3
+
4
+ def trim_words(words, lens):
5
+ trimmed_words = []
6
+ time.sleep(5)
7
+ for w, l in zip(words, lens):
8
+ trimmed_words.append(w[:int(l)])
9
+ return [trimmed_words]
10
+
11
+ with gr.Blocks() as demo:
12
+ with gr.Row():
13
+ word = gr.Textbox(label="word")
14
+ leng = gr.Number(label="leng")
15
+ output = gr.Textbox(label="Output")
16
+ with gr.Row():
17
+ run = gr.Button()
18
+
19
+ event = run.click(trim_words, [word, leng], output, batch=True, max_batch_size=16)
20
+
21
+ demo.queue()
22
+ demo.launch(share=True)