Upload inference.py
Browse files- inference.py +1 -1
inference.py
CHANGED
@@ -26,7 +26,7 @@ img = Image.open(image_path).convert('RGB')
|
|
26 |
aspect_ratio = img.width / img.height
|
27 |
new_height = math.sqrt(512 ** 2 / aspect_ratio)
|
28 |
new_width = aspect_ratio * new_height
|
29 |
-
img.
|
30 |
tensor = transform(img).unsqueeze(0).to(device)
|
31 |
with torch.no_grad():
|
32 |
out = model(tensor)
|
|
|
26 |
aspect_ratio = img.width / img.height
|
27 |
new_height = math.sqrt(512 ** 2 / aspect_ratio)
|
28 |
new_width = aspect_ratio * new_height
|
29 |
+
img.thumbnail((int(new_width), int(new_height)), Image.LANCZOS)
|
30 |
tensor = transform(img).unsqueeze(0).to(device)
|
31 |
with torch.no_grad():
|
32 |
out = model(tensor)
|