Skip to content

Commit

Permalink
moving logic from pre and post processes to predict
Browse files Browse the repository at this point in the history
  • Loading branch information
animeshsingh committed May 9, 2019
1 parent af2c7f3 commit 5c22c18
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions python/sklearnserver/sklearnserver/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ def load(self):
self.ready = True

def preprocess(self, inputs):
return inputs

def postprocess(self, outputs):
return outputs

def predict(self, inputs):
try:
return np.array(inputs)
inputs = np.array(inputs)
except Exception as e:
raise Exception(
"Failed to initialize NumPy array from inputs: %s, %s" % (e, inputs))

def postprocess(self, outputs):
return outputs.tolist()

def predict(self, inputs):
try:
result = self._joblib.predict(inputs)
result = self._joblib.predict(inputs).tolist()
return result
except Exception as e:
raise Exception("Failed to predict %s" % e)

0 comments on commit 5c22c18

Please sign in to comment.