import logging from config.env_setup import setup_environment # 환경 변수 설정을 최우선으로 호출 setup_environment() # 로깅 기본 설정 logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s - %(message)s" ) logger = logging.getLogger("startup") from fastapi import FastAPI from router import deepseek_router from services.ocr_engine import init_engine logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s - %(message)s" ) app = FastAPI( title="DeepSeek OCR Service", description="OCR Gateway로부터 파일 요청을 받아 텍스트를 추출하는 API", docs_url="/docs", ) @app.on_event("startup") async def startup_event(): """FastAPI startup event handler.""" logging.info("Application startup...") try: await init_engine() logging.info("vLLM engine initialized successfully.") except Exception as e: logging.error(f"vLLM engine init failed: {e}", exc_info=True) @app.get("/health/API", include_in_schema=False) async def health_check(): return {"status": "API ok"} app.include_router(deepseek_router)