Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,10 +20,10 @@ labels = r.text.split("\n")
|
|
| 20 |
|
| 21 |
# Define prediction function
|
| 22 |
def predict(img):
|
| 23 |
-
# Transform image to pytorch tensor of shape [1,
|
| 24 |
-
img = T.
|
| 25 |
-
img = T.Resize(size=(224, 224))
|
| 26 |
-
|
| 27 |
|
| 28 |
# Use model without gradients to reduce computation
|
| 29 |
with torch.no_grad():
|
|
|
|
| 20 |
|
| 21 |
# Define prediction function
|
| 22 |
def predict(img):
|
| 23 |
+
# Transform image to pytorch tensor of shape [1, 3, 224, 224]
|
| 24 |
+
img = T.PILToTensor()(img).unsqueeze(0)
|
| 25 |
+
img = T.Resize(size=(224, 224))(img)
|
| 26 |
+
|
| 27 |
|
| 28 |
# Use model without gradients to reduce computation
|
| 29 |
with torch.no_grad():
|