File size: 331 Bytes
69fd4ce
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import joblib
import numpy as np

class Model:
    def __init__(self):
        self.model = joblib.load("mnist_logistic_regression.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)}