File size: 580 Bytes
3f3de3d
 
 
 
 
 
 
 
7aafe66
d425dcc
3f3de3d
 
7aafe66
 
e9d4dcd
7aafe66
3f3de3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python

import gradio as gr

with gr.Blocks() as demo:
    text = gr.Text()
    out = gr.Text()
    btn = gr.Button()
    btn2 = gr.Button()
    btn3 = gr.Button()
    text.submit(fn=lambda x: x, inputs=text, outputs=out, api_name=False)
    btn.click(fn=lambda x: x, inputs=text, outputs=out, api_name='run')
    btn2.click(fn=lambda x: "hello", inputs=text, outputs=out, api_name='say_hello')
    text.change(fn=lambda x: x, inputs=text, outputs=out, api_name=False)
    btn3.click(fn=lambda x: "42", inputs=text, outputs=out, api_name='')

demo.queue().launch()