GSLC-MLOps / src /inference.py
github-actions
Deploy from GitHub Actions: 4025db1ea73f71f9c2a3953aa74dd93cdedb2084
d7f4720
Raw
History Blame Contribute Delete
324 Bytes
import numpy as np
from joblib import load
from src.utils import MODEL_PATH
_model = None
def get_model():
global _model
if _model is None:
_model = load(MODEL_PATH)
return _model
def predict_one(x_row: np.ndarray) -> int:
mdl = get_model()
return int(mdl.predict(x_row.reshape(1, -1))[0])