Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
-
def
|
5 |
-
|
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(
|
23 |
-
video_button.click(
|
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 |
|