MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / post

Method post

supervised_class/app.py:28–38  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

26class PredictionHandler(tornado.web.RequestHandler):
27 # predict one sample at a time
28 def post(self):
29 # print "body:", self.request.body
30 # print "arguments:", self.request.arguments
31 # will look like this:
32 # body: three=four&one=two
33 # arguments: {'three': ['four'], 'one': ['two']}
34 params = self.request.arguments
35 x = np.array(list(map(float, params['input'])))
36 y = model.predict([x])[0]
37 self.write(json.dumps({'prediction': y.item()}))
38 self.finish()
39
40if __name__ == "__main__":
41 application = tornado.web.Application([

Callers 2

client.pyFile · 0.80
app_caller.pyFile · 0.80

Calls 1

predictMethod · 0.45

Tested by

no test coverage detected