Download test.py from yeter/gradio_test: direct link, hf CLI and curl.
- Browser
- Download file 552 Bytes
-
https://huggingface.co/yeter/gradio_test/resolve/main/test.py
- Command line
-
hf download hf://yeter/gradio_test/test.py
-
curl -L -o test.py https://huggingface.co/yeter/gradio_test/resolve/main/test.py
552 Bytes
| import gradio as gr | |
| import time | |
| def trim_words(words, lens): | |
| trimmed_words = [] | |
| time.sleep(5) | |
| for w, l in zip(words, lens): | |
| trimmed_words.append(w[:int(l)]) | |
| return [trimmed_words] | |
| with gr.Blocks() as demo: | |
| with gr.Row(): | |
| word = gr.Textbox(label="word") | |
| leng = gr.Number(label="leng") | |
| output = gr.Textbox(label="Output") | |
| with gr.Row(): | |
| run = gr.Button() | |
| event = run.click(trim_words, [word, leng], output, batch=True, max_batch_size=16) | |
| demo.queue() | |
| demo.launch(share=True) |