MadhurGarg commited on
Commit
a7132f6
·
1 Parent(s): fa98a90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -24,16 +24,10 @@ model = LitResnet()
24
  model.load_state_dict(torch.load("model.pth", map_location=torch.device('cpu')), strict=False)
25
  model.eval()
26
 
27
- transform = A.Compose(
28
- [
29
- A.Normalize(
30
- mean=(0.485, 0.456, 0.406),
31
- std=(0.229, 0.224, 0.225),
32
- p=1.0,
33
- max_pixel_value=255,
34
- ),
35
- ToTensorV2()
36
- ])
37
 
38
  inv_normalize = T.Normalize(
39
  mean=[-0.50/0.23, -0.50/0.23, -0.50/0.23],
@@ -50,8 +44,7 @@ def get_gradcam_image(input_tensor, label, target_layer):
50
 
51
 
52
  def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2, 3], transparency=0.5):
53
- input_image = transform(image=input_image)
54
- #aug(image=image)
55
  input_image = input_image.unsqueeze(0)
56
  output = model(input_image)
57
  output = F.softmax(output.flatten(), dim=-1)
 
24
  model.load_state_dict(torch.load("model.pth", map_location=torch.device('cpu')), strict=False)
25
  model.eval()
26
 
27
+ transform = transforms.Compose([
28
+ transforms.ToTensor(),
29
+ transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
30
+ ])
 
 
 
 
 
 
31
 
32
  inv_normalize = T.Normalize(
33
  mean=[-0.50/0.23, -0.50/0.23, -0.50/0.23],
 
44
 
45
 
46
  def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2, 3], transparency=0.5):
47
+ input_image = transform(input_image)
 
48
  input_image = input_image.unsqueeze(0)
49
  output = model(input_image)
50
  output = F.softmax(output.flatten(), dim=-1)