parameters: (app)
docstring: Parse command line options and start the server.
docstring_summary: Parse command line options and start the server.
docstring_tokens: Parse command line options and start the server .
function: def start_from_terminal(app):
      """
      Parse command line options and start the server.
      """
      parser = optparse.OptionParser()
      parser.add_option(
          '-d', '--debug',
          help="enable debug mode",
          action="store_true", default=False)
      parser.add_option(
          '-p', '--port',
          help="which port to serve content on",
          type='int', default=5000)
      parser.add_option(
          '-g', '--gpu',
          help="use gpu mode",
          action='store_true', default=False)
  
      opts, args = parser.parse_args()
      ImagenetClassifier.default_args.update({'gpu_mode': opts.gpu})
  
      # Initialize classifier + warm start by forward for allocation
      app.clf = ImagenetClassifier(**ImagenetClassifier.default_args)
      app.clf.net.forward()
  
      if opts.debug:
          app.run(debug=True, host='0.0.0.0', port=opts.port)
      else:
          start_tornado(app, opts.port)
function_tokens: def start_from_terminal ( app ) : parser = optparse . OptionParser ( ) parser . add_option ( '-d' , '--debug' , help = "enable debug mode" , action = "store_true" , default = False ) parser . add_option ( '-p' , '--port' , help = "which port to serve content on" , type = 'int' , default = 5000 ) parser . add_option ( '-g' , '--gpu' , help = "use gpu mode" , action = 'store_true' , default = False ) opts , args = parser . parse_args ( ) ImagenetClassifier . default_args . update ( { 'gpu_mode' : opts . gpu } ) # Initialize classifier + warm start by forward for allocation app . clf = ImagenetClassifier ( * * ImagenetClassifier . default_args ) app . clf . net . forward ( ) if opts . debug : app . run ( debug = True , host = '0.0.0.0' , port = opts . port ) else : start_tornado ( app , opts . port )