Spaces:
Running
Running
| """ | |
| 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, | |
| ) | |
| async def root(): | |
| """Serve the SPA entry point.""" | |
| return FileResponse(INDEX_FILE, media_type="text/html; charset=utf-8") | |
| async def healthz(): | |
| """Health check endpoint used by Spaces to verify the container is alive.""" | |
| return JSONResponse({"ok": True}) | |
| # Favicon์ด ์์ด์ 404 ๋ก๊ทธ๊ฐ ๊ณ์ ๋จ๋ ๊ฒ ๋ฐฉ์ง | |
| async def favicon(): | |
| return JSONResponse({}, status_code=204) | |