sentivity commited on
Commit
38c4b60
·
verified ·
1 Parent(s): 027fc46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
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
- return ((score - 0.65) / 0.2 * 100) * (1 if score >= 0 else -1)
 
 
 
 
 
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