ongkn commited on
Commit
4534e51
·
unverified ·
1 Parent(s): c6c02a4

pull it, asshole

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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
- face = face.resize((224, 224))
37
- tensor = transforms.ToTensor()(face)
38
  dffImage = run_dff_on_image(model=model,
39
  target_layer=targetLayerDff,
40
  classifier=model.classifier,
41
- img_pil=face,
42
- img_tensor=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=face,
51
- img_tensor=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