from contextlib import asynccontextmanager from fastapi import FastAPI from app.ml.model_manager import model_manager from app.config.logging import logger @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...")