Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,13 +20,13 @@ def predict(image):
|
|
20 |
# determined by the first position in the shape tuple, in this case 1.
|
21 |
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)
|
22 |
# Replace this with the path to your image
|
23 |
-
|
24 |
#resize the image to a 224x224 with the same strategy as in TM2:
|
25 |
#resizing the image to be at least 224x224 and then cropping from the center
|
26 |
size = (224, 224)
|
27 |
-
|
28 |
image = ImageOps.fit(image, size, Image.Resampling.LANCZOS)
|
29 |
-
|
30 |
#turn the image into a numpy array
|
31 |
image_array = np.asarray(image)
|
32 |
# Normalize the image
|
|
|
20 |
# determined by the first position in the shape tuple, in this case 1.
|
21 |
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)
|
22 |
# Replace this with the path to your image
|
23 |
+
|
24 |
#resize the image to a 224x224 with the same strategy as in TM2:
|
25 |
#resizing the image to be at least 224x224 and then cropping from the center
|
26 |
size = (224, 224)
|
27 |
+
image = gr.inputs.Image()
|
28 |
image = ImageOps.fit(image, size, Image.Resampling.LANCZOS)
|
29 |
+
|
30 |
#turn the image into a numpy array
|
31 |
image_array = np.asarray(image)
|
32 |
# Normalize the image
|