File size: 743 Bytes
88c9af4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
import gradio as gr


import gradio as gr
import time

def slowly_reverse(word, progress=gr.Progress()):
    progress(0, desc="Starting")
    time.sleep(1)
    progress(0.05)
    new_string = ""
    for letter in progress.tqdm(word, desc="Reversing"):
        time.sleep(0.25)
        new_string = letter + new_string
    return new_string, None

with gr.Blocks() as demo:

    with gr.Row(elem_id=123) as row:

        t1 = gr.Text()
        t2 = gr.Text()

        b = gr.Button("Test")

        
    with gr.Row():

        sl = gr.Text(interactive=False)


        b.click(slowly_reverse,
            inputs = [t1],
            outputs= [t2, sl],
            show_progress=True
            )


    demo.queue(concurrency_count=10).launch()