INNER CODE UNIT · Python

lifespan

speaches-ai/speaches · src/speaches/main.py:81

async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
    logger = logging.getLogger(__name__)
    config = get_config()

    if config.preload_models:
        logger.info(f"Preloading {len(config.preload_models)} models on startup")
        executor_registry = get_executor_registry()

        for model_id in config.preload_models:
            logger.info(f"Downloading model: {model_id}")
            executor_registry.download_model_by_id(model_id)
            logger.info(f"Successfully downloaded model: {model_id}")

    yield


def create_app() -> FastAPI:
    config = get_config()  # HACK

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…