Update README.md
Browse files
README.md
CHANGED
|
@@ -66,15 +66,13 @@ with torch.no_grad():
|
|
| 66 |
logits = model_output.logits.squeeze(-1).float().cpu().numpy()
|
| 67 |
|
| 68 |
# scores are produced in the range [0, 4]. To convert to the range [1, 5], we can simply add 1 to the score.
|
| 69 |
-
score =
|
| 70 |
|
| 71 |
-
|
| 72 |
"text": text,
|
| 73 |
"score": score,
|
| 74 |
-
"
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
print(result)
|
| 78 |
```
|
| 79 |
|
| 80 |
|
|
|
|
| 66 |
logits = model_output.logits.squeeze(-1).float().cpu().numpy()
|
| 67 |
|
| 68 |
# scores are produced in the range [0, 4]. To convert to the range [1, 5], we can simply add 1 to the score.
|
| 69 |
+
score = [x + 1 for x in logits.tolist()][0]
|
| 70 |
|
| 71 |
+
print({
|
| 72 |
"text": text,
|
| 73 |
"score": score,
|
| 74 |
+
"int_score": [int(round(max(0, min(score, 4)))) + 1 for score in logits][0],
|
| 75 |
+
})
|
|
|
|
|
|
|
| 76 |
```
|
| 77 |
|
| 78 |
|