INNER CODE UNIT · Python

lifespan

cubist38/mlx-openai-server · app/server.py:160

    async def lifespan(app: FastAPI) -> None:
        """FastAPI lifespan callable that initializes MLX handlers.

        On startup this function selects and initializes the correct
        model handler based on ``config_args`` and attaches it to
        ``app.state.handler``. It also performs an initial memory
        cleanup. On shutdown it invokes the handler's ``cleanup``
        method and runs a final memory cleanup.

        Parameters
        ----------
        app:
            FastAPI application instance being started.
        """
        try:
            model_cfg = config_args.to_model_entry_config()
            ensure_image_handler_available(model_cfg.model_type)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…