dawood HF Staff commited on
Commit
96fd926
·
1 Parent(s): c15643b

Create app.py

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