Spaces:
Runtime error
Runtime error
debug print
Browse files
app.py
CHANGED
|
@@ -18,12 +18,14 @@ output_layer = compiled_model.output(0)
|
|
| 18 |
#####
|
| 19 |
def predict(img: np.ndarray) -> str:
|
| 20 |
# input: numpy array of image in RGB (see defaults for https://www.gradio.app/docs/#image)
|
| 21 |
-
|
| 22 |
# The MobileNet model expects images in RGB format.
|
| 23 |
# Resize to MobileNet image shape.
|
| 24 |
input_image = cv2.resize(src=img, dsize=(224, 224))
|
|
|
|
| 25 |
# Reshape to model input shape.
|
| 26 |
input_image = np.expand_dims(input_image, 0)
|
|
|
|
| 27 |
|
| 28 |
# Get inference result
|
| 29 |
result_infer = compiled_model([input_image])[output_layer]
|
|
|
|
| 18 |
#####
|
| 19 |
def predict(img: np.ndarray) -> str:
|
| 20 |
# input: numpy array of image in RGB (see defaults for https://www.gradio.app/docs/#image)
|
| 21 |
+
print(f'initial image shape: {img.shape}')
|
| 22 |
# The MobileNet model expects images in RGB format.
|
| 23 |
# Resize to MobileNet image shape.
|
| 24 |
input_image = cv2.resize(src=img, dsize=(224, 224))
|
| 25 |
+
print(f'resized: {img.shape}')
|
| 26 |
# Reshape to model input shape.
|
| 27 |
input_image = np.expand_dims(input_image, 0)
|
| 28 |
+
print(f'final shape: {img.shape}')
|
| 29 |
|
| 30 |
# Get inference result
|
| 31 |
result_infer = compiled_model([input_image])[output_layer]
|