try: data = request2json(request.data) return json.dumps(logger.log(data)) except Exception as e: print "log failure" return "Failure" def parse_arg(argv): parser = argparse.ArgumentParser(description='') parser.add_argument('-a', '--address', default='0.0.0.0', help='accesible address') parser.add_argument('-p', '--port', default=5125, type=int, help='port') parser.add_argument('-d', '--debug', action='store_true', help='debug mode') return parser.parse_args(argv[1:]) if __name__ == "__main__": args = parse_arg(sys.argv) controler = Controler(os.path.abspath('../model')) # emotions = np.array(controler.list_model()['LJ40K_svm']) emotions = np.array(controler.list_model()['YAHOO_svm']) logger = Logger() if args.debug: args.port += 1 app.run(args.address, args.port, debug=False, threaded=True, use_reloader=False) else: print "* Running on http://{}:{}/".format(args.address, args.port) WSGIServer(app, multithreaded=True, bindAddress=(args.address, args.port)).run()
default='0.0.0.0', help='accesible address') parser.add_argument('-p', '--port', default=5125, type=int, help='port') parser.add_argument('-d', '--debug', action='store_true', help='debug mode') return parser.parse_args(argv[1:]) if __name__ == "__main__": args = parse_arg(sys.argv) controler = Controler(os.path.abspath('../model')) # emotions = np.array(controler.list_model()['LJ40K_svm']) emotions = np.array(controler.list_model()['YAHOO_svm']) logger = Logger() if args.debug: args.port += 1 app.run(args.address, args.port, debug=False, threaded=True, use_reloader=False) else: print "* Running on http://{}:{}/".format(args.address, args.port) WSGIServer(app, multithreaded=True, bindAddress=(args.address, args.port)).run()