akhaliq HF staff commited on
Commit
c20245c
1 Parent(s): 4b52ff7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import torch
2
  from PIL import Image
3
  from torchvision import transforms
@@ -36,7 +37,7 @@ def inference(input_image):
36
  # The output has unnormalized scores. To get probabilities, you can run a softmax on it.
37
  probabilities = torch.nn.functional.softmax(output[0], dim=0)
38
  # Download ImageNet labels
39
- !wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt
40
  # Read the categories
41
  with open("imagenet_classes.txt", "r") as f:
42
  categories = [s.strip() for s in f.readlines()]
 
1
+ import os
2
  import torch
3
  from PIL import Image
4
  from torchvision import transforms
 
37
  # The output has unnormalized scores. To get probabilities, you can run a softmax on it.
38
  probabilities = torch.nn.functional.softmax(output[0], dim=0)
39
  # Download ImageNet labels
40
+ os.system("wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt")
41
  # Read the categories
42
  with open("imagenet_classes.txt", "r") as f:
43
  categories = [s.strip() for s in f.readlines()]