Spaces:
Runtime error
Runtime error
chore: remove debugging code.
Browse files
app.py
CHANGED
@@ -112,12 +112,8 @@ def infer(video_file):
|
|
112 |
with torch.no_grad():
|
113 |
outputs = MODEL(**inputs)
|
114 |
logits = outputs.logits
|
115 |
-
predicted_label = logits.argmax(-1).item()
|
116 |
-
print(f"Predicted class: {MODEL.config.id2label[predicted_label]}")
|
117 |
softmax_scores = torch.nn.functional.softmax(logits, dim=-1).squeeze(0)
|
118 |
-
print(f"Softmax scores: {softmax_scores}.")
|
119 |
confidences = {LABELS[i]: float(softmax_scores[i]) for i in range(len(LABELS))}
|
120 |
-
print(f"Confidence dict: {confidences}")
|
121 |
return confidences
|
122 |
|
123 |
|
|
|
112 |
with torch.no_grad():
|
113 |
outputs = MODEL(**inputs)
|
114 |
logits = outputs.logits
|
|
|
|
|
115 |
softmax_scores = torch.nn.functional.softmax(logits, dim=-1).squeeze(0)
|
|
|
116 |
confidences = {LABELS[i]: float(softmax_scores[i]) for i in range(len(LABELS))}
|
|
|
117 |
return confidences
|
118 |
|
119 |
|