Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,19 @@ label_binarizer = pickle.load(open('label_transform.pkl', 'rb'))
|
|
12 |
# Function to convert images to array
|
13 |
def convert_image_to_array(image):
|
14 |
try:
|
|
|
|
|
|
|
|
|
15 |
image = cv2.imdecode(np.frombuffer(image, np.uint8), cv2.IMREAD_COLOR)
|
|
|
16 |
if image is not None:
|
|
|
17 |
image = cv2.resize(image, (256, 256))
|
|
|
18 |
return img_to_array(image)
|
19 |
else:
|
|
|
20 |
return np.array([])
|
21 |
except Exception as e:
|
22 |
print(f"Error: {e}")
|
|
|
12 |
# Function to convert images to array
|
13 |
def convert_image_to_array(image):
|
14 |
try:
|
15 |
+
# Debugging: Print image type and size
|
16 |
+
print(f"Image type: {type(image)}")
|
17 |
+
print(f"Image size: {len(image)} bytes")
|
18 |
+
|
19 |
image = cv2.imdecode(np.frombuffer(image, np.uint8), cv2.IMREAD_COLOR)
|
20 |
+
|
21 |
if image is not None:
|
22 |
+
print(f"Decoded image shape: {image.shape}")
|
23 |
image = cv2.resize(image, (256, 256))
|
24 |
+
print(f"Resized image shape: {image.shape}")
|
25 |
return img_to_array(image)
|
26 |
else:
|
27 |
+
print("Image decoding returned None")
|
28 |
return np.array([])
|
29 |
except Exception as e:
|
30 |
print(f"Error: {e}")
|