Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,9 +63,11 @@ def generate_answer_vilt(processor, model, image, question):
|
|
| 63 |
with torch.no_grad():
|
| 64 |
outputs = model(**encoding)
|
| 65 |
print(outputs.logits)
|
| 66 |
-
print(torch.
|
| 67 |
predicted_class_idx = outputs.logits.argmax(-1).item()
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
return model.config.id2label[predicted_class_idx]
|
| 70 |
|
| 71 |
|
|
|
|
| 63 |
with torch.no_grad():
|
| 64 |
outputs = model(**encoding)
|
| 65 |
print(outputs.logits)
|
| 66 |
+
print(torch.LogSoftmax(outputs.logits, dim=1))
|
| 67 |
predicted_class_idx = outputs.logits.argmax(-1).item()
|
| 68 |
+
logitsList = outputs.logits.tolist()
|
| 69 |
+
print(logitsList)
|
| 70 |
+
maybeProbsList = [exp(i) for i in logitsList]
|
| 71 |
return model.config.id2label[predicted_class_idx]
|
| 72 |
|
| 73 |
|