yeter commited on
Commit
49592dd
·
1 Parent(s): 9b22231

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import gradio as gr
3
+ def flip_text(x):
4
+ return x[::-1]
5
+ def flip_image(x):
6
+ return np.fliplr(x)
7
+ with gr.Blocks() as demo:
8
+ gr.Markdown("Flip text or image files using this demo.")
9
+ with gr.Tab("Flip Text"):
10
+ with gr.Column():
11
+ text_input = gr.Textbox()
12
+ text_output = gr.Textbox()
13
+ text_button = gr.Button("Flip")
14
+ with gr.Tab("Flip Image"):
15
+ with gr.Row():
16
+ image_input = gr.Image()
17
+ image_output = gr.Image()
18
+ image_button = gr.Button("Flip")
19
+ with gr.Accordion("Open for More!"):
20
+ gr.Markdown("Look at me...")
21
+ text_button.click(flip_text, inputs=text_input, outputs=text_output)
22
+ image_button.click(flip_image, inputs=image_input, outputs=image_output)
23
+ demo.launch()