Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,8 @@ from pytorch_grad_cam.utils.image import show_cam_on_image
|
|
14 |
with zipfile.ZipFile("examples.zip","r") as zip_ref:
|
15 |
zip_ref.extractall(".")
|
16 |
|
17 |
-
DEVICE = 'cuda
|
18 |
-
|
19 |
mtcnn = MTCNN(
|
20 |
select_largest=False,
|
21 |
post_process=False,
|
@@ -66,8 +66,8 @@ def predict(input_image:Image.Image, true_label:str):
|
|
66 |
|
67 |
target_layers=[model.block8.branch1[-1]]
|
68 |
use_cuda = True if torch.cuda.is_available() else False
|
69 |
-
print ("Cuda :: "
|
70 |
-
cam = GradCAM(model=model, target_layers=target_layers, use_cuda=use_cuda)
|
71 |
targets = [ClassifierOutputTarget(0)]
|
72 |
|
73 |
grayscale_cam = cam(input_tensor=face, targets=targets, eigen_smooth=True)
|
|
|
14 |
with zipfile.ZipFile("examples.zip","r") as zip_ref:
|
15 |
zip_ref.extractall(".")
|
16 |
|
17 |
+
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
18 |
+
'''cuda:0'''
|
19 |
mtcnn = MTCNN(
|
20 |
select_largest=False,
|
21 |
post_process=False,
|
|
|
66 |
|
67 |
target_layers=[model.block8.branch1[-1]]
|
68 |
use_cuda = True if torch.cuda.is_available() else False
|
69 |
+
'''print ("Cuda :: ", use_cuda)'''
|
70 |
+
cam = GradCAM(model=model, target_layers=target_layers) ''', use_cuda=use_cuda)'''
|
71 |
targets = [ClassifierOutputTarget(0)]
|
72 |
|
73 |
grayscale_cam = cam(input_tensor=face, targets=targets, eigen_smooth=True)
|