code: def __call__(self) -> Starlette:
      from starlette.applications import Starlette
  
      from ..configuration import get_debug_mode
  
      @contextlib.asynccontextmanager
      async def lifespan(_: Starlette) -> t.AsyncGenerator[None, None]:
          for on_startup in self.on_startup:
              if is_async_callable(on_startup):
                  await on_startup()
              else:
                  on_startup()
          yield
          for on_shutdown in self.on_shutdown:
              if is_async_callable(on_shutdown):
                  await on_shutdown()
              else:
                  on_shutdown()
  
      return Starlette(
          debug=get_debug_mode(),
          routes=self.routes,
          middleware=self.middlewares,
          lifespan=lifespan,
      )
  
file_path: BentoML/src/bentoml/_internal/server/base_app.py
imports: from __future__ import annotations
  import abc
  import contextlib
  import logging
  import typing
  from typing import TYPE_CHECKING
  from starlette.exceptions import HTTPException
  from starlette.middleware import Middleware
  from starlette.responses import PlainTextResponse
  from ..utils import is_async_callable
label_desc: Use image node_id 6 for calling the BaseAppFactory obj's underlying member method code with example usage: obj.__call__() and returns: Starlette