quantumbit commited on
Commit
69fd4ce
·
verified ·
1 Parent(s): 79e8585

Create inference.py

Browse files
Files changed (1) hide show
  1. inference.py +11 -0
inference.py ADDED
@@ -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_logistic_regression.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)}