Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -281,10 +281,7 @@ def predict(image):
|
|
| 281 |
|
| 282 |
annotated_img = output[0]
|
| 283 |
|
| 284 |
-
|
| 285 |
-
print("annotated_img shape before reshape:", annotated_img.shape)
|
| 286 |
-
annotated_img = annotated_img.reshape(original_image_shape)
|
| 287 |
-
print("annotated_img shape after reshape:", annotated_img.shape)
|
| 288 |
|
| 289 |
# annotated_img = (output[0] / 255.0 - mean)/std
|
| 290 |
# annotated_img = classes[output[0][0].argmax(0)]
|
|
@@ -305,7 +302,12 @@ def predict(image):
|
|
| 305 |
print("Min value of image after normalization:", np.min(annotated_img))
|
| 306 |
print("Max value of image after normalization:", np.max(annotated_img))
|
| 307 |
print("annotated_img type after normalization:", type(annotated_img))
|
| 308 |
-
print("annotated_img shape after normalization:", annotated_img.shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
|
| 310 |
# Convert to PIL Image
|
| 311 |
annotated_img = Image.fromarray(annotated_img)
|
|
|
|
| 281 |
|
| 282 |
annotated_img = output[0]
|
| 283 |
|
| 284 |
+
|
|
|
|
|
|
|
|
|
|
| 285 |
|
| 286 |
# annotated_img = (output[0] / 255.0 - mean)/std
|
| 287 |
# annotated_img = classes[output[0][0].argmax(0)]
|
|
|
|
| 302 |
print("Min value of image after normalization:", np.min(annotated_img))
|
| 303 |
print("Max value of image after normalization:", np.max(annotated_img))
|
| 304 |
print("annotated_img type after normalization:", type(annotated_img))
|
| 305 |
+
# print("annotated_img shape after normalization:", annotated_img.shape)
|
| 306 |
+
|
| 307 |
+
# Reshape the image to match the PIL Image input shape
|
| 308 |
+
print("annotated_img shape before reshape:", annotated_img.shape)
|
| 309 |
+
annotated_img = annotated_img.reshape(original_image_shape)
|
| 310 |
+
print("annotated_img shape after reshape:", annotated_img.shape)
|
| 311 |
|
| 312 |
# Convert to PIL Image
|
| 313 |
annotated_img = Image.fromarray(annotated_img)
|