Spaces:
Sleeping
Sleeping
File size: 599 Bytes
18fcef9 a96982b 18fcef9 a96982b 18fcef9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Get predicitons from pre trained ML model
import utils
import joblib
def get_predictions(text: str) -> tuple:
"""
Returns predictions of aggressions and misogyny as per the model
"""
cleaned_data = [utils.clean_one_text(text)]
# Load Models
model_1 = joblib.load(utils.TASK_1_MODEL)
model_2 = joblib.load(utils.TASK_2_MODEL)
# Predictions
pred_1 = model_1.predict(cleaned_data)[0]
pred_2 = model_2.predict(cleaned_data)[0]
return (utils.TASK_1_MAP[pred_1], utils.TASK_2_MAP[pred_2])
if __name__ == "__main__":
print(get_predictions("Hello"))
|