gradio/demo/progress_simple/run.py
Abubakar Abid d1f044145a
Use covariant container types across the codebase and add typing to our demos (#8854)
* more typing

* add changeset

* tweaks

* more changes

* more fixes

* more changes

* more fixes

* more fixes

* delete

* add changeset

* notebooks

* restore

* restore

* format

* add changeset

* more typing fixes

* fixes

* change

* fixes

* fix

* format

* more fixes

* fixes

* fixes for python3.9

* demo

* fix

* fixes

* fix typo

* type

* formatting

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
2024-07-19 18:34:34 -07:00

18 lines
439 B
Python

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 # type: ignore
return new_string
demo = gr.Interface(slowly_reverse, gr.Text(), gr.Text())
if __name__ == "__main__":
demo.launch()