def _train(self): # labeled = map(int, request.get_json()['labeled']) payload = request.get_json() try: self.train_fn(payload) return jsonify({"status": 200}) except Exception as e: traceback.print_exceptions(sys.exc_info()) return jsonify({"status": 500})
def _infer(self): payload = request.get_json() try: res = self.infer_fn(payload) res["status"] = 200 return jsonify(res) except Exception as e: traceback.print_exceptions(sys.exc_info()) return jsonify({"status": 500})
def _test(self): payload = request.get_json() try: res = self.test_fn(payload) res['status'] = 200 return jsonify(res) except Exception as e: traceback.print_exceptions(sys.exc_info()) return jsonify({'status': 500})