import gradio as gr | |
def hello_world(name, request: gr.Request): | |
return f'Hello {name}!' | |
def hello_world_tab(): | |
with gr.Tab("hello world!"): | |
with gr.Row(): | |
text_input = gr.Textbox(label='姓名', placeholder='请输入你的姓名') | |
text_output = gr.Textbox(label="结果", lines=10) | |
text_button = gr.Button('hello world') | |
text_button.click(hello_world, inputs=text_input, outputs=text_output) | |