Spaces:
Sleeping
Sleeping
Commit
·
1e811a4
1
Parent(s):
d925fb3
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import numpy as np
|
2 |
import cv2
|
3 |
-
|
4 |
import gradio as gr
|
5 |
|
6 |
SIDE_IMG = 320
|
@@ -8,6 +8,8 @@ BLACK_TOLERANCE = 20
|
|
8 |
|
9 |
LIMIT_FOR_DISEASE = 0.8
|
10 |
|
|
|
|
|
11 |
def remove_borders_color(image):
|
12 |
image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
13 |
image_gray[image_gray < BLACK_TOLERANCE] = 0
|
@@ -22,11 +24,13 @@ def get_image(path):
|
|
22 |
return resize_image_square(remove_borders_color(image), SIDE_IMG)
|
23 |
|
24 |
|
25 |
-
def
|
26 |
-
|
|
|
|
|
27 |
|
28 |
interface = gr.Interface(
|
29 |
-
|
30 |
inputs = [gr.inputs.Image(source="upload",type="filepath", label="Imagen")],
|
31 |
outputs = [gr.outputs.Image(type="auto", label=None)]
|
32 |
)
|
|
|
1 |
import numpy as np
|
2 |
import cv2
|
3 |
+
import keras
|
4 |
import gradio as gr
|
5 |
|
6 |
SIDE_IMG = 320
|
|
|
8 |
|
9 |
LIMIT_FOR_DISEASE = 0.8
|
10 |
|
11 |
+
|
12 |
+
|
13 |
def remove_borders_color(image):
|
14 |
image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
15 |
image_gray[image_gray < BLACK_TOLERANCE] = 0
|
|
|
24 |
return resize_image_square(remove_borders_color(image), SIDE_IMG)
|
25 |
|
26 |
|
27 |
+
def predict(path):
|
28 |
+
image = get_image(path)
|
29 |
+
return image
|
30 |
+
|
31 |
|
32 |
interface = gr.Interface(
|
33 |
+
predict,
|
34 |
inputs = [gr.inputs.Image(source="upload",type="filepath", label="Imagen")],
|
35 |
outputs = [gr.outputs.Image(type="auto", label=None)]
|
36 |
)
|