Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -53,8 +53,13 @@ def predict_sentiment(text):
|
|
53 |
input_ids, attention_mask = encoded_input["input_ids"], encoded_input["attention_mask"]
|
54 |
with torch.no_grad():
|
55 |
score = score_model(input_ids, attention_mask)[0].item()
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
|
60 |
# uses Polygon API to fetch article
|
|
|
53 |
input_ids, attention_mask = encoded_input["input_ids"], encoded_input["attention_mask"]
|
54 |
with torch.no_grad():
|
55 |
score = score_model(input_ids, attention_mask)[0].item()
|
56 |
+
|
57 |
+
scaled=((score - 0.65) / 0.2 * 100)
|
58 |
+
|
59 |
+
if scaled>=0:
|
60 |
+
return scaled
|
61 |
+
else:
|
62 |
+
return scaled*-1
|
63 |
|
64 |
|
65 |
# uses Polygon API to fetch article
|