import joblib | |
import numpy as np | |
class Model: | |
def __init__(self): | |
self.model = joblib.load("mnist_random_forest.pkl") # Change for logistic and RF | |
def predict(self, inputs): | |
inputs = np.array(inputs).reshape(1, -1) | |
digit = self.model.predict(inputs)[0] | |
return {"digit": int(digit)} | |