| import gradio as gr | |
| import time | |
| def greet(text): | |
| print('\n') | |
| print(text) | |
| print('start sleep') | |
| time.sleep(5) | |
| print('end sleep') | |
| print(text) | |
| return "echo " + text | |
| with gr.Blocks() as demo: | |
| input_text = gr.Textbox(label='in') | |
| output_text = gr.Textbox(label='out') | |
| btn = gr.Button("Run") | |
| btn.click(fn=greet, inputs=input_text, outputs=output_text) | |
| demo.launch() |