linkdom commited on
Commit
d2d04ab
1 Parent(s): 9e534f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -21,21 +21,21 @@
21
  # demo.launch(share=True)
22
 
23
  import gradio as gr
24
- import numpy as np
25
  import time
26
 
27
- # define core fn, which returns a generator {steps} times before returning the image
28
- def my_generator(steps):
29
- for i in range(steps):
30
- time.sleep(1)
31
- yield i
32
- yield steps
 
 
 
33
 
 
34
 
35
- demo = gr.Interface(my_generator, inputs=gr.Slider(1, 10, 3), outputs="number")
36
-
37
- # define queue - required for generators
38
- demo.queue()
39
 
40
- demo.launch(share=True)
41
 
 
21
  # demo.launch(share=True)
22
 
23
  import gradio as gr
 
24
  import time
25
 
26
+ def slowly_reverse(word, progress=gr.Progress()):
27
+ progress(0, desc="Starting")
28
+ time.sleep(1)
29
+ progress(0.05)
30
+ new_string = ""
31
+ for letter in progress.tqdm(word, desc="Reversing"):
32
+ time.sleep(0.25)
33
+ new_string = letter + new_string
34
+ return new_string
35
 
36
+ demo = gr.Interface(slowly_reverse, gr.Text(), gr.Text())
37
 
38
+ if __name__ == "__main__":
39
+ demo.queue(concurrency_count=10).launch()
 
 
40
 
 
41