Spaces:
Sleeping
Sleeping
File size: 1,000 Bytes
15f041f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | """
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)
|