drhead commited on
Commit
4c782db
1 Parent(s): 69fc921

unify implementations

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -156,7 +156,8 @@ def run_classifier(image, threshold):
156
  tensor = transform(img).unsqueeze(0)
157
 
158
  with torch.no_grad():
159
- values, indices = torch.topk(model(tensor)[0], 250)
 
160
 
161
  tag_score = dict()
162
  for i in range(indices.size(0)):
 
156
  tensor = transform(img).unsqueeze(0)
157
 
158
  with torch.no_grad():
159
+ probits = model(tensor)[0]
160
+ values, indices = probits.topk(250)
161
 
162
  tag_score = dict()
163
  for i in range(indices.size(0)):