yuhe6 commited on
Commit
147ccfa
·
1 Parent(s): f626afb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -47,7 +47,7 @@ def inference(input_image):
47
  with open("dog_cat.txt", "r") as f:
48
  categories = [s.strip() for s in f.readlines()]
49
  # Show top categories per image
50
- top5_prob, top5_catid = torch.topk(probabilities, 1)
51
  result = {}
52
  for i in range(top5_prob.size(0)):
53
  result[categories[top5_catid[i]]] = top5_prob[i].item()
 
47
  with open("dog_cat.txt", "r") as f:
48
  categories = [s.strip() for s in f.readlines()]
49
  # Show top categories per image
50
+ top5_prob, top5_catid = torch.topk(probabilities, 2)
51
  result = {}
52
  for i in range(top5_prob.size(0)):
53
  result[categories[top5_catid[i]]] = top5_prob[i].item()