Spaces:
Build error
Build error
Commit
·
9815b9f
1
Parent(s):
9eff9c7
Update app.py
Browse files
app.py
CHANGED
@@ -14,12 +14,12 @@ for param in model.parameters():
|
|
14 |
|
15 |
# # Add a avgpool here
|
16 |
# avgpool = nn.AdaptiveAvgPool2d((7, 7))
|
17 |
-
|
18 |
# # Replace the classifier layer
|
19 |
# # to customise it according to our output
|
20 |
model.classifier = nn.Sequential(
|
21 |
-
nn.Linear(
|
22 |
-
nn.Linear(1024, 256),
|
23 |
nn.Linear(256, 2))
|
24 |
|
25 |
checkpoint = torch.load(
|
@@ -39,7 +39,7 @@ transform = transforms.Compose(
|
|
39 |
|
40 |
def predict(img):
|
41 |
img = transform(img).to('cpu')
|
42 |
-
|
43 |
with torch.no_grad():
|
44 |
out= model(img)
|
45 |
probability = torch.nn.functional.softmax(out[0],dim=0)
|
|
|
14 |
|
15 |
# # Add a avgpool here
|
16 |
# avgpool = nn.AdaptiveAvgPool2d((7, 7))
|
17 |
+
#
|
18 |
# # Replace the classifier layer
|
19 |
# # to customise it according to our output
|
20 |
model.classifier = nn.Sequential(
|
21 |
+
nn.Linear(36, 256),
|
22 |
+
# nn.Linear(1024, 256),
|
23 |
nn.Linear(256, 2))
|
24 |
|
25 |
checkpoint = torch.load(
|
|
|
39 |
|
40 |
def predict(img):
|
41 |
img = transform(img).to('cpu')
|
42 |
+
img = transform(img).unsqueeze(0)
|
43 |
with torch.no_grad():
|
44 |
out= model(img)
|
45 |
probability = torch.nn.functional.softmax(out[0],dim=0)
|