Spaces:
Sleeping
Sleeping
change files
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import requests
|
|
7 |
|
8 |
# Load the pre-trained MobileNetV2 model from torchvision
|
9 |
model = models.mobilenet_v2(pretrained=True)
|
10 |
-
device = torch.device("
|
11 |
model.to(device)
|
12 |
model.eval() # Set model to evaluation mode
|
13 |
|
@@ -33,7 +33,7 @@ def preprocess_image(image):
|
|
33 |
# Prediction function
|
34 |
def predict(image):
|
35 |
# Load the input file
|
36 |
-
reloaded_img_tensor = torch.load(image).to(torch.device("
|
37 |
|
38 |
# Make predictions
|
39 |
output = model(reloaded_img_tensor)
|
|
|
7 |
|
8 |
# Load the pre-trained MobileNetV2 model from torchvision
|
9 |
model = models.mobilenet_v2(pretrained=True)
|
10 |
+
device = torch.device("cpu")
|
11 |
model.to(device)
|
12 |
model.eval() # Set model to evaluation mode
|
13 |
|
|
|
33 |
# Prediction function
|
34 |
def predict(image):
|
35 |
# Load the input file
|
36 |
+
reloaded_img_tensor = torch.load(image).to(torch.device("cpu"))
|
37 |
|
38 |
# Make predictions
|
39 |
output = model(reloaded_img_tensor)
|