Spaces:
Sleeping
Sleeping
Commit
·
068ba40
1
Parent(s):
40ed0b9
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def predict(video_in, image_in_video, image_in_img):
|
4 |
if video_in == None and image_in_video == None and image_in_img == None:
|
@@ -48,6 +55,7 @@ with gr.Blocks() as blocks:
|
|
48 |
outputs=[image_in_video, image_in_img], queue=False, show_progress=False)
|
49 |
with gr.Column():
|
50 |
image_out = gr.Image()
|
|
|
51 |
run_btn = gr.Button("Run")
|
52 |
run_btn.click(fn=predict, inputs=[
|
53 |
image_in_img, image_in_video], outputs=[image_out])
|
|
|
1 |
import gradio as gr
|
2 |
+
import opencv as cv2
|
3 |
+
|
4 |
+
def color_to_gray(img):
|
5 |
+
new_img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
|
6 |
+
return new_img
|
7 |
+
|
8 |
+
|
9 |
|
10 |
def predict(video_in, image_in_video, image_in_img):
|
11 |
if video_in == None and image_in_video == None and image_in_img == None:
|
|
|
55 |
outputs=[image_in_video, image_in_img], queue=False, show_progress=False)
|
56 |
with gr.Column():
|
57 |
image_out = gr.Image()
|
58 |
+
image_out = color_to_gray(image_out)
|
59 |
run_btn = gr.Button("Run")
|
60 |
run_btn.click(fn=predict, inputs=[
|
61 |
image_in_img, image_in_video], outputs=[image_out])
|