Spaces:
Sleeping
Sleeping
File size: 718 Bytes
a980198 |
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 26 27 28 29 30 |
import components.utils as utils
from components.config import app_config
import joblib
def get_predictions(text: str) -> tuple[str, str]:
"""Gets Predictions for the Texts
Args:
text (str): The input text to get predictions for
Returns:
tuple[str, str]: Predictions for task A and task B
"""
cleaned_data = [utils.clean_one_text(text)]
# Load Models
model_1 = joblib.load(app_config.TASK_A_MODEL_PATH)
model_2 = joblib.load(app_config.TASK_B_MODEL_PATH)
# Predictions
pred_1 = model_1.predict(cleaned_data)[0]
pred_2 = model_2.predict(cleaned_data)[0]
return (
app_config.TASK_A_MAP[pred_1],
app_config.TASK_B_MAP[pred_2],
)
|