""" AI Label Stamper — FastAPI static server 이미지 처리는 전부 브라우저(Canvas)에서 수행되므로 서버는 index.html 만 서빙합니다. """ from pathlib import Path from fastapi import FastAPI from fastapi.responses import FileResponse, JSONResponse BASE_DIR = Path(__file__).parent INDEX_FILE = BASE_DIR / "index.html" app = FastAPI( title="AI Label Stamper", description="Client-side image AI-label stamper", version="1.0.0", docs_url=None, redoc_url=None, ) @app.get("/", response_class=FileResponse) async def root(): """Serve the SPA entry point.""" return FileResponse(INDEX_FILE, media_type="text/html; charset=utf-8") @app.get("/healthz") async def healthz(): """Health check endpoint used by Spaces to verify the container is alive.""" return JSONResponse({"ok": True}) # Favicon이 없어서 404 로그가 계속 뜨는 것 방지 @app.get("/favicon.ico") async def favicon(): return JSONResponse({}, status_code=204)