akhaliq HF staff commited on
Commit
c64a577
1 Parent(s): 8bc2e9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -10,11 +10,9 @@ utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_convnets_
10
  resnet50.eval().to(device)
11
 
12
  def inference(img):
13
-
14
  img_transforms = transforms.Compose(
15
  [transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor()]
16
  )
17
-
18
  img = img_transforms(img)
19
  with torch.no_grad():
20
  # mean and std are not multiplied by 255 as they are in training script
@@ -29,7 +27,7 @@ def inference(img):
29
  [img]
30
  ).to(device)
31
 
32
- with torch.no_grad():
33
  output = torch.nn.functional.softmax(resnet50(batch), dim=1)
34
 
35
  results = utils.pick_n_best(predictions=output, n=5)
 
10
  resnet50.eval().to(device)
11
 
12
  def inference(img):
 
13
  img_transforms = transforms.Compose(
14
  [transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor()]
15
  )
 
16
  img = img_transforms(img)
17
  with torch.no_grad():
18
  # mean and std are not multiplied by 255 as they are in training script
 
27
  [img]
28
  ).to(device)
29
 
30
+ with torch.no_grad():
31
  output = torch.nn.functional.softmax(resnet50(batch), dim=1)
32
 
33
  results = utils.pick_n_best(predictions=output, n=5)