pull it, asshole
Browse files
app.py
CHANGED
@@ -33,13 +33,13 @@ def classify_image(input):
|
|
33 |
if face is None:
|
34 |
return "No face detected", 0, input
|
35 |
face = Image.fromarray(face)
|
36 |
-
|
37 |
-
|
38 |
dffImage = run_dff_on_image(model=model,
|
39 |
target_layer=targetLayerDff,
|
40 |
classifier=model.classifier,
|
41 |
-
img_pil=
|
42 |
-
img_tensor=
|
43 |
reshape_transform=gradCam.reshape_transform_vit_huggingface,
|
44 |
n_components=5,
|
45 |
top_k=10
|
@@ -47,8 +47,8 @@ def classify_image(input):
|
|
47 |
gradCamImage = gradCam.run_grad_cam_on_image(model=model,
|
48 |
target_layer=targetLayerGradCam,
|
49 |
classifier=model.classifier,
|
50 |
-
img_pil=
|
51 |
-
img_tensor=
|
52 |
reshape_transform=gradCam.reshape_transform_vit_huggingface,
|
53 |
n_components=5,
|
54 |
top_k=10
|
|
|
33 |
if face is None:
|
34 |
return "No face detected", 0, input
|
35 |
face = Image.fromarray(face)
|
36 |
+
faceResized = face.resize((224, 224))
|
37 |
+
tensorResized = transforms.ToTensor()(faceResized)
|
38 |
dffImage = run_dff_on_image(model=model,
|
39 |
target_layer=targetLayerDff,
|
40 |
classifier=model.classifier,
|
41 |
+
img_pil=faceResized,
|
42 |
+
img_tensor=tensorResized,
|
43 |
reshape_transform=gradCam.reshape_transform_vit_huggingface,
|
44 |
n_components=5,
|
45 |
top_k=10
|
|
|
47 |
gradCamImage = gradCam.run_grad_cam_on_image(model=model,
|
48 |
target_layer=targetLayerGradCam,
|
49 |
classifier=model.classifier,
|
50 |
+
img_pil=faceResized,
|
51 |
+
img_tensor=tensorResized,
|
52 |
reshape_transform=gradCam.reshape_transform_vit_huggingface,
|
53 |
n_components=5,
|
54 |
top_k=10
|