Update model_utils.py
Browse files- model_utils.py +5 -1
model_utils.py
CHANGED
|
@@ -48,7 +48,11 @@ def predict(model, img_tensor, device):
|
|
| 48 |
with torch.no_grad():
|
| 49 |
output = model(img_tensor.unsqueeze(0).to(device))
|
| 50 |
probs = torch.sigmoid(output[0]).cpu().numpy()
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
|
|
|
|
| 48 |
with torch.no_grad():
|
| 49 |
output = model(img_tensor.unsqueeze(0).to(device))
|
| 50 |
probs = torch.sigmoid(output[0]).cpu().numpy()
|
| 51 |
+
|
| 52 |
+
# Sort all results by descending probability
|
| 53 |
+
sorted_probs = sorted(zip(DISEASE_LIST, probs), key=lambda x: x[1], reverse=True)
|
| 54 |
+
return dict(sorted_probs)
|
| 55 |
+
|
| 56 |
|
| 57 |
|
| 58 |
|