Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,8 @@ model = model.cpu()
|
|
14 |
|
15 |
def transform_image(image):
|
16 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
17 |
-
my_transforms =
|
18 |
-
|
19 |
[0.485, 0.456, 0.406],
|
20 |
[0.229, 0.224, 0.225])])
|
21 |
image_aux = image
|
@@ -23,7 +23,7 @@ def transform_image(image):
|
|
23 |
|
24 |
def predict(img):
|
25 |
img = PIL.Image.fromarray(img, "RGB")
|
26 |
-
image =
|
27 |
tensor = transform_image(image=image)
|
28 |
|
29 |
learner.to(device)
|
|
|
14 |
|
15 |
def transform_image(image):
|
16 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
17 |
+
my_transforms = transforms.Compose([transforms.ToTensor(),
|
18 |
+
transforms.Normalize(
|
19 |
[0.485, 0.456, 0.406],
|
20 |
[0.229, 0.224, 0.225])])
|
21 |
image_aux = image
|
|
|
23 |
|
24 |
def predict(img):
|
25 |
img = PIL.Image.fromarray(img, "RGB")
|
26 |
+
image = transforms.Resize((480,640))(img)
|
27 |
tensor = transform_image(image=image)
|
28 |
|
29 |
learner.to(device)
|