Spaces:
Runtime error
Runtime error
Ignahugging
commited on
Commit
•
0753246
1
Parent(s):
2c52192
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,8 @@
|
|
1 |
import cv2
|
2 |
import numpy as np
|
3 |
-
import matplotlib.pyplot as plt
|
4 |
import gradio as gr
|
5 |
|
6 |
def imagen(image):
|
7 |
-
print(type(image),image.dtype)
|
8 |
-
#image = cv2.imread(np.uint8(image))
|
9 |
-
print(f"Image shape: {image.shape}\nImage dtype {image.dtype}")
|
10 |
image= cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
|
11 |
grayImage = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
12 |
grayImage = cv2.GaussianBlur(grayImage, (3, 3), 0)
|
@@ -17,11 +13,10 @@ def imagen(image):
|
|
17 |
output = np.zeros(grayImage.shape)
|
18 |
output = cv2.bitwise_and(edgePreservingImage, edgePreservingImage, mask=edgeImage)
|
19 |
candidate = cv2.cvtColor(output,cv2.COLOR_RGB2BGR)
|
20 |
-
#cv2.imwrite('candidate.png',candidate)
|
21 |
return candidate
|
22 |
|
23 |
interface = gr.Interface(imagen,
|
24 |
-
inputs = gr.inputs.Image(
|
25 |
outputs = "image",
|
26 |
title="Gamify your photo")
|
27 |
interface.launch(inline=False)
|
|
|
1 |
import cv2
|
2 |
import numpy as np
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
def imagen(image):
|
|
|
|
|
|
|
6 |
image= cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
|
7 |
grayImage = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
8 |
grayImage = cv2.GaussianBlur(grayImage, (3, 3), 0)
|
|
|
13 |
output = np.zeros(grayImage.shape)
|
14 |
output = cv2.bitwise_and(edgePreservingImage, edgePreservingImage, mask=edgeImage)
|
15 |
candidate = cv2.cvtColor(output,cv2.COLOR_RGB2BGR)
|
|
|
16 |
return candidate
|
17 |
|
18 |
interface = gr.Interface(imagen,
|
19 |
+
inputs = gr.inputs.Image(),
|
20 |
outputs = "image",
|
21 |
title="Gamify your photo")
|
22 |
interface.launch(inline=False)
|