File size: 1,565 Bytes
24b454f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import gradio as gr
'''
https://blog.csdn.net/DreamingBetter/article/details/123854496
https://blog.51cto.com/u_15485092/6223566
'''
def txt_output(txt_in):
    return txt_in
with gr.Blocks() as demo:
    output_str = ""
    with gr.Row():
        shot_select = gr.Dropdown(label="景别 远中近",type="value",choices=["广", "远"])
        cam_select = gr.Dropdown(label="机位 俯仰角度",choices=("仰", "俯"))
        special_select = gr.CheckboxGroup(label="画面效果",choices=("失真","模糊","聚焦"))
        body_select = gr.inputs.Radio(['全身','半身'],label="半全身")

    with gr.Row():
        txt_cn_in = gr.inputs.Textbox(label="输入中文")
        btn_cn = gr.Button("中>>英")
        txt_en_in = gr.Text(interactive=True)
        btn_cn.click(fn=txt_output, inputs=txt_cn_in, outputs=txt_en_in)

    with gr.Row():
        txt_en_in = gr.inputs.Textbox(label="输入英文")
        btn_en = gr.Button("英>>中")
        txt_en_out = gr.Text(label="result", interactive=True)
        btn_en.click(fn=txt_output, inputs=txt_en_in, outputs=txt_en_out)

demo.launch()
import gradio as gr
def welcome(name):
    t = type(name)

    return f"{t}"
with gr.Blocks() as demo:
    gr.Markdown(
    """
    # Hello World!
    Start typing below to see the output.
    """)

    with gr.Row():
        shot_select = gr.Dropdown(label="景别 远中近",type="value",choices=["广", "远"])

    inp = shot_select
    out = gr.Textbox()
    #设置change事件
    inp.change(fn = welcome, inputs = inp, outputs = out)
demo.launch()