Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,16 +20,6 @@ def preprocess_image(image_path):
|
|
| 20 |
img1 = cv2.imread(image_path)
|
| 21 |
img1 = cv2.resize(img1, (64, 64)) # Resize to 64x64
|
| 22 |
img1 = np.asarray(img1) # Convert to numpy array, shape will be (64, 64, 3)
|
| 23 |
-
|
| 24 |
-
# Add batch dimension to get (1, 64, 64, 3)
|
| 25 |
-
img1 = img1[np.newaxis, :, :, :]
|
| 26 |
-
|
| 27 |
-
# Verify shape
|
| 28 |
-
if len(img1.shape) != 4:
|
| 29 |
-
raise ValueError(f"Expected shape (batch_size, 64, 64, 3), got {img1.shape}")
|
| 30 |
-
if img1.shape[1:] != (64, 64, 3):
|
| 31 |
-
raise ValueError(f"Image dimensions should be (64, 64, 3), got {img1.shape[1:]}")
|
| 32 |
-
|
| 33 |
return img1
|
| 34 |
|
| 35 |
# Main app
|
|
|
|
| 20 |
img1 = cv2.imread(image_path)
|
| 21 |
img1 = cv2.resize(img1, (64, 64)) # Resize to 64x64
|
| 22 |
img1 = np.asarray(img1) # Convert to numpy array, shape will be (64, 64, 3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
return img1
|
| 24 |
|
| 25 |
# Main app
|