quantumbit commited on
Commit
c9b1fe7
·
verified ·
1 Parent(s): 58338c4

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +11 -0
inference.py CHANGED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import numpy as np
3
+
4
+ class Model:
5
+ def __init__(self):
6
+ self.model = joblib.load("mnist_random_forest.pkl") # Change for logistic and RF
7
+
8
+ def predict(self, inputs):
9
+ inputs = np.array(inputs).reshape(1, -1)
10
+ digit = self.model.predict(inputs)[0]
11
+ return {"digit": int(digit)}