from contextlib import asynccontextmanager from fastapi import FastAPI from app.config.logging import logger from app.ml.model_manager import model_manager @asynccontextmanager async def lifespan(app: FastAPI): logger.info("Loading AI models...") model_manager.initialize() logger.info("AI models loaded.") yield logger.info("Stopping AI Service...")