def process(self, cv_image): label = opencv.Label.get(opencv.Label.name == self.get_secure_cookie('label')) logging.info("Got label: %s" % label.name) if not label: logging.info("No cookie, bailing out") return logging.info("About to save image") result = opencv.Image(label=label).persist(cv_image) if result == 'Done': self.write_message(json.dumps(result))
def main(): tornado.options.parse_command_line() opencv.Image().delete() logging.info("Images deleted") opencv.Label().delete() logging.info("Labels deleted") opencv.load_images_to_db("data/images") logging.info("Labels and images loaded") opencv.train() logging.info("Model trained") app = Application() app.listen(options.port) tornado.ioloop.IOLoop.instance().start()