topk works a lot better when you actually use it
Browse files
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.
|
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()
|