wall-e-zz commited on
Commit
db2abfe
·
1 Parent(s): 0a74fbf

Add application file

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