File size: 668 Bytes
396078f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import numpy as np
import gradio as gr
 
def flip_text(x):
    return x[::-1]
 
def flip_image(x):
    return np.fliplr(x)
 
with gr.Blocks() as demo:
    gr.Markdown("My AI interface")
    with gr.Tab("Single models"):
        text_input = gr.Textbox()
        text_output = gr.Textbox()
        text_button = gr.Button("Flip")
    with gr.Tab("Multi models"):
        with gr.Row():
            image_input = gr.Image()
            image_output = gr.Image()
        image_button = gr.Button("Flip")
 
    text_button.click(flip_text, inputs=text_input, outputs=text_output)
    image_button.click(flip_image, inputs=image_input, outputs=image_output)
 
demo.launch()