Spaces:
Runtime error
Runtime error
img size fix
Browse files
app.py
CHANGED
@@ -92,18 +92,18 @@ def set_image_resolution(image, percentage):
|
|
92 |
resized_img = cv2.resize(img, (new_width, new_height))
|
93 |
return resized_img
|
94 |
|
95 |
-
def predict(link,
|
96 |
|
97 |
categories = read_json_categories(os.getcwd() + '/annotations/instances_train2017.json')
|
98 |
|
99 |
if(link):
|
100 |
img = read_image(link)
|
101 |
else:
|
102 |
-
img = read_image(
|
103 |
-
|
104 |
-
img = img[:, :, ::-1]
|
105 |
-
print(type(img))
|
106 |
img_resized = set_image_resolution(img, image_resolution)
|
|
|
|
|
107 |
|
108 |
predictions, visualized_output = demo.run_on_image(img_resized, threshold)
|
109 |
|
|
|
92 |
resized_img = cv2.resize(img, (new_width, new_height))
|
93 |
return resized_img
|
94 |
|
95 |
+
def predict(link, url, threshold, image_resolution):
|
96 |
|
97 |
categories = read_json_categories(os.getcwd() + '/annotations/instances_train2017.json')
|
98 |
|
99 |
if(link):
|
100 |
img = read_image(link)
|
101 |
else:
|
102 |
+
img = read_image(url)
|
103 |
+
|
|
|
|
|
104 |
img_resized = set_image_resolution(img, image_resolution)
|
105 |
+
img = treat_grayscale(img_resized)
|
106 |
+
img = img[:, :, ::-1]
|
107 |
|
108 |
predictions, visualized_output = demo.run_on_image(img_resized, threshold)
|
109 |
|