class_docstr: Development version of LIT server.
  
  This wraps the real LIT server and allows for quick reloading of the server
  code without reloading models or datasets.
class_docstr_tok: ["Development","version","of","LIT","server",".","This","wraps","the","real","LIT","server","and","allows","for","quick","reloading","of","the","server","code","without","reloading","models","or","datasets","."]
docstr: Run server, with optional reload loop and cache saving.
  
  If the server type is 'external', then the app is returned instead of
  served by this module.
  
  Returns:
    WSGI app if the server type is 'external', server if the server type
    is 'notebook', otherwise None when serving is complete.
docstr_tok: ["Run","server",",","with","optional","reload","loop","and","cache","saving",".","If","the","server","type","is","'external","'",",","then","the","app","is","returned","instead","of","served","by","this","module",".","Returns",":","WSGI","app","if","the","server","type","is","'external","'",",","server","if","the","server","type","is","'notebook","'",",","otherwise","None","when","serving","is","complete","."]
code: def serve(self) -> Optional[LitServerType]:
      """Run server, with optional reload loop and cache saving.
  
      If the server type is 'external', then the app is returned instead of
      served by this module.
  
      Returns:
        WSGI app if the server type is 'external', server if the server type
        is 'notebook', otherwise None when serving is complete.
      """
  
      logging.info(
          termcolor.colored(get_lit_logo(), "red", attrs=["bold"])
      )
      logging.info(
          termcolor.colored(
              "Starting LIT server...", "green", attrs=["bold"]
          )
      )
      app = lit_app.LitApp(*self._app_args, **self._app_kw)
  
      # If using a separate server program to serve the app, such as gunicorn,
      # then just return the WSGI app instead of serving it directly.
      if self._server_type == "external":
          return app
      # Pre-bake mode runs any warm-start functions, saves the cache,
      # and exits. Designed to be used in container setup for faster launching.
      if self._server_type == "prebake":
          app.save_cache()
          logging.info("Pre-bake completed; exiting server.")
          return
  
      server_fn = WSGI_SERVERS[self._server_type]
      server = server_fn(app, **self._server_kw)
  
      # server.serve isn't blocking for notebook server type.
      # For other types, the underlying server registers a SIGINT handler,
      # so if you hit Ctrl+C it will return.
      server.serve()
      if self._server_type == "notebook":
          return server
      app.save_cache()
  
file_path: lit/lit_nlp/dev_server.py
imports: import inspect
  from typing import Optional, Union
  from absl import logging
  from lit_nlp import app
  from lit_nlp.lib import wsgi_serving
  import termcolor
label_desc: Use image node_id 2 for calling the Server obj's underlying member method code with example usage: obj.serve() and returns: app, server