YANGYYYY commited on
Commit
2064e3d
1 Parent(s): 1f25689

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -1,11 +1,10 @@
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.")
@@ -19,8 +18,8 @@ with gr.Blocks() as demo:
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
 
 
1
  import numpy as np
2
  import gradio as gr
3
+ import cv2
4
 
5
+ def to_black(image):
6
+ output = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
7
+ return output
 
 
8
 
9
  with gr.Blocks() as demo:
10
  gr.Markdown("Flip image or video files using this demo.")
 
18
  video_input = gr.Video()
19
  video_output = gr.Video()
20
  video_button = gr.Button("Flip")
21
+ image_button.click(to_black, inputs=image_input, outputs=image_output)
22
+ video_button.click(to_black, inputs=video_input, outputs=video_output)
23
 
24
  demo.launch()
25