File size: 748 Bytes
4f1b10a
 
c771de6
4f1b10a
 
 
c771de6
 
 
 
 
 
4f1b10a
c771de6
 
 
 
 
 
 
 
 
 
 
4f1b10a
c771de6
 
4f1b10a
 
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
import gradio as gr
import transformers as tr
import numpy as np

demo = gr.Blocks()

def f1(x):
    return x[::-1]

def f3(x):
    return np.fliplr(x)

with demo:
    gr.Markdown("Flip text or image files using this demo.")
    with gr.Tabs():
        with gr.TabItem("Flip Text"):
            text_input = gr.Textbox()
            text_output = gr.Textbox()
            text_button = gr.Button("Flip")
        with gr.TabItem("Flip Image"):
            with gr.Row():
                image_input = gr.Image()
                image_output = gr.Image()
            image_button = gr.Button("Flip")

    text_button.click(f1, inputs=text_input, outputs=text_output)
    image_button.click(f2, inputs=image_input, outputs=image_output)

demo.launch()