Spaces:
Runtime error
Runtime error
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() |