drhead commited on
Commit
0642f5b
1 Parent(s): 374865c

topk works a lot better when you actually use it

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -139,7 +139,7 @@ def run_classifier(image, threshold):
139
  with torch.no_grad():
140
  logits = model(tensor)
141
  probabilities = torch.nn.functional.sigmoid(logits[0])
142
- indices = torch.where(probabilities, 250).indices
143
  values = probabilities[indices]
144
 
145
  tag_score = dict()
 
139
  with torch.no_grad():
140
  logits = model(tensor)
141
  probabilities = torch.nn.functional.sigmoid(logits[0])
142
+ indices = torch.topk(probabilities, 250).indices
143
  values = probabilities[indices]
144
 
145
  tag_score = dict()