File size: 771 Bytes
d58ac58
9be4786
d58ac58
9be4786
 
ce05317
9be4786
 
ce05317
9be4786
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce05317
d58ac58
9be4786
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
import gradio as gr
import numpy as np

def flip_text(text):
    return text[::-1]

def flip_img(img):
    return np.flipud(img)

with gr.Blocks() as demo:
    gr.Markdown("flip the text or image using this demo")
    with gr.Tab("Flip Text"):
        text_input = gr.Textbox();
        text_output = gr.Textbox();
        text_btn = gr.Button("Flip");
    with gr.Tab("Flip Img"):
        with gr.Row():
            image_input = gr.Image(source="webcam");
            image_outpt = gr.Image();
        image_btn = gr.Button("Flip");
    with gr.Accordion("Open for more"):
        gr.Markdown("Look at me");
    
    text_btn.click(flip_text, inputs=text_input, outputs=text_output)
    image_btn.click(flip_img, inputs=image_input, outputs=image_outpt)


demo.launch()