akhaliq HF staff commited on
Commit
4783163
1 Parent(s): 7822c47

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
@@ -46,7 +47,7 @@ def inference(input_image):
46
  # The output has unnormalized scores. To get probabilities, you can run a softmax on it.
47
  probabilities = torch.nn.functional.softmax(output[0], dim=0)
48
  # Download ImageNet labels
49
- !wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt
50
  # Read the categories
51
  with open("imagenet_classes.txt", "r") as f:
52
  categories = [s.strip() for s in f.readlines()]
 
1
+ import os
2
  import torch
3
  from PIL import Image
4
  from torchvision import transforms
 
47
  # The output has unnormalized scores. To get probabilities, you can run a softmax on it.
48
  probabilities = torch.nn.functional.softmax(output[0], dim=0)
49
  # Download ImageNet labels
50
+ os.system("wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt")
51
  # Read the categories
52
  with open("imagenet_classes.txt", "r") as f:
53
  categories = [s.strip() for s in f.readlines()]