File size: 411 Bytes
e569c5f
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
def greet(name):
    return "Hello " + name + "!"
with gr.Blocks() as demo:
    # 设置输入组件
    name = gr.Textbox(label="Name")
    # 设置输出组件
    output = gr.Textbox(label="Output Box")
    # 设置按钮
    greet_btn = gr.Button("Greet")
    # 设置按钮点击事件,默认是垂直
    greet_btn.click(fn=greet, inputs=name, outputs=output)
demo.launch(share=True)