Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,11 +40,14 @@ class_labels = ['bird', 'cat', 'deer', 'dog', 'frog', 'horse']
|
|
40 |
# Image transformation function
|
41 |
def transform_image(image):
|
42 |
"""Preprocess the input image."""
|
|
|
|
|
43 |
transform = transforms.Compose([
|
44 |
-
transforms.Resize(
|
45 |
transforms.ToTensor(),
|
46 |
-
transforms.Normalize(
|
47 |
])
|
|
|
48 |
img_tensor = transform(image).unsqueeze(0).to(device)
|
49 |
return img_tensor
|
50 |
|
|
|
40 |
# Image transformation function
|
41 |
def transform_image(image):
|
42 |
"""Preprocess the input image."""
|
43 |
+
mean, std = [0.4914, 0.4822, 0.4465], [0.247, 0.243, 0.261]
|
44 |
+
img_size=224
|
45 |
transform = transforms.Compose([
|
46 |
+
transforms.Resize((img_size, img_size)),
|
47 |
transforms.ToTensor(),
|
48 |
+
transforms.Normalize(mean, std)
|
49 |
])
|
50 |
+
|
51 |
img_tensor = transform(image).unsqueeze(0).to(device)
|
52 |
return img_tensor
|
53 |
|