def on_post(self, req, resp): self.PF = PathFinder() self.sm = StatMaster() # try: request = decode(req) content = request.get('labels', []) success, message = self.sm.delete_label(content) # except Exception as e: # content, success, message = {}, False, str(e) resp.body = json.dumps({'success': success, 'message': message})
def on_post(self, req, resp): self.PF = PathFinder() self.sm = StatMaster() request = decode(req) class_name = request.get('class_name', []) try: content, success, message = self.sm.get_image_path_by_label( class_name) except Exception as e: content, success, message = [], False, str(e) data = {'data': content, 'success': success, 'message': message} resp.body = json.dumps(data)
def on_get(self, req, resp): try: self.PF = PathFinder() self.sm = StatMaster() image_info = self.sm.get_image_info() label_info = self.sm.get_label_info() bound_box_leak = self.sm.check_bounding_box_leak() content = { 'imageInfo': image_info, 'labelInfo': label_info, 'boundBoxLeak': bound_box_leak } success, message = True, "" except Exception as e: content, success, message = {}, False, str(e) data = {'data': content, 'success': success, 'message': message} resp.body = json.dumps(data)