YANGYYYY commited on
Commit
1f25689
1 Parent(s): a8500ae

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 image or video files using this demo.")
12
+ with gr.Tabs():
13
+ with gr.TabItem("Flip Image"):
14
+ with gr.Row():
15
+ image_input = gr.Image()
16
+ image_output = gr.Image()
17
+ image_button = gr.Button("Flip")
18
+ with gr.TabItem("Flip Video"):
19
+ video_input = gr.Video()
20
+ video_output = gr.Video()
21
+ video_button = gr.Button("Flip")
22
+ image_button.click(flip_image, inputs=image_input, outputs=image_output)
23
+ video_button.click(flip_text, inputs=video_input, outputs=video_output)
24
+
25
+ demo.launch()
26
+
27
+ # 启动接口
28
+ #demo.launch(server_name='127.0.0.1',server_port=7788)