class PredictionHandler(RestClass):
    def set_default_headers(self):
        print("setting headers!!!")
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "x-requested-with")
        self.set_header('Access-Control-Allow-Methods',
                        ' PUT, DELETE, OPTIONS')

    def __init(self):
        self.name = "PredictionHandler"
        self.bPrediction = BO_Prediction()

    def get(self):
        self.__init()
        self.write("Prediction Handler")
        logger_info("Code @ " + self.name + " GET")

    def post(self):
        self.__init()
        logger_info("Code @ " + self.name + " POST")
        print(self.request.body)

        # json_data = tornado.escape.json_decode(self.request.body)
        # print("Json Data here:")
        # print(json_data)

        prediction_result = self.bPrediction.disease_prediction(
            json.loads(self.request.body))
        json_response = json.dumps({'result': str(prediction_result)})
        self.write(json_response)
class PredictionHandler(RestClass):
    def set_default_headers(self):
        print("setting headers!!!")
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "x-requested-with")
        self.set_header('Access-Control-Allow-Methods', ' PUT, DELETE, OPTIONS')

    def __init(self):
        self.name = "PredictionHandler"
        self.bPrediction = BO_Prediction()

    def get(self):
        self.__init()
        self.write("Prediction Handler")
        logger_info("Code @ " + self.name + " GET")

    def post(self):
        self.__init()
        logger_info("Code @ " + self.name + " POST")
        print(self.request.body)

        # json_data = tornado.escape.json_decode(self.request.body)
        # print("Json Data here:")
        # print(json_data)

        prediction_result = self.bPrediction.disease_prediction(json.loads(self.request.body))
        json_response = json.dumps({'result': str(prediction_result)})
        self.write(json_response)
Example #3
0
class PredictionHandler(RestClass):
    def __init(self):
        self.name = 'PredictionHandler'
        self.bPrediction = BO_Prediction()

    def get(self):
        self.__init()
        self.write("Code block reached to Prediction Handler")
        logger_info("Code @ " + self.name + " GET")

    def post(self):
        self.__init()
        logger_info("Code @ " + self.name + " POST")
        prediction_result = self.bPrediction.disease_prediction(
            json.loads(self.request.body))
        json_response = json.dumps({'result': str(prediction_result)})
        self.write(json_response)
class PredictionHandler(RestClass):
    def __init(self):
        self.name = 'PredictionHandler'
        self.model = self.config['keras_model']
        self.bPrediction = BO_Prediction()

    def get(self):
        self.__init()
        self.write("Code block reached to Prediction Handler")
        logger_info("Code @ " + self.name + " GET")

    def post(self):
        self.__init()
        logger_info("Code @ " + self.name + " POST")
        a = self.request
        body = tornado.escape.json_decode(self.request.body)
        prediction_result = self.bPrediction.sms_classifier(body, self.model)
        json_response = json.dumps({'result': str(prediction_result)})
        self.write(json_response)
 def __init(self):
     self.name = "PredictionHandler"
     self.bPrediction = BO_Prediction()
 def __init(self):
     self.name = "PredictionHandler"
     self.bPrediction = BO_Prediction()
 def __init(self):
     self.name = 'PredictionHandler'
     self.model = self.config['keras_model']
     self.bPrediction = BO_Prediction()