thushalya
commited on
Commit
•
aea70a5
1
Parent(s):
13f875c
Add round
Browse files
app.py
CHANGED
@@ -368,7 +368,7 @@ def load_model(tweet):
|
|
368 |
def greet(tweet):
|
369 |
print("start")
|
370 |
prediction = load_model(tweet)
|
371 |
-
prediction_value = prediction.item()
|
372 |
# features_list = extract_features(tweet)
|
373 |
# print(personality_detection(tweet))
|
374 |
# print(str(features_list["Average_Word_Length"]))
|
@@ -376,9 +376,9 @@ def greet(tweet):
|
|
376 |
predicted_class = torch.round(prediction).item()
|
377 |
print("end")
|
378 |
if (predicted_class==0.0):
|
379 |
-
label = "Hate"
|
380 |
-
else:
|
381 |
label = "Non Hate"
|
|
|
|
|
382 |
|
383 |
|
384 |
return label,str(prediction_value)+"%",str(1-prediction_value)+"%"
|
|
|
368 |
def greet(tweet):
|
369 |
print("start")
|
370 |
prediction = load_model(tweet)
|
371 |
+
prediction_value = round(prediction.item(),2)
|
372 |
# features_list = extract_features(tweet)
|
373 |
# print(personality_detection(tweet))
|
374 |
# print(str(features_list["Average_Word_Length"]))
|
|
|
376 |
predicted_class = torch.round(prediction).item()
|
377 |
print("end")
|
378 |
if (predicted_class==0.0):
|
|
|
|
|
379 |
label = "Non Hate"
|
380 |
+
else:
|
381 |
+
label = "Hate"
|
382 |
|
383 |
|
384 |
return label,str(prediction_value)+"%",str(1-prediction_value)+"%"
|