save code
This commit is contained in:
+13
-1
@@ -13,7 +13,8 @@ from __future__ import annotations
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI, File, Form, HTTPException, UploadFile
|
||||
from fastapi.responses import JSONResponse, Response
|
||||
from fastapi.responses import FileResponse, JSONResponse, Response
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from .face_renderer import (
|
||||
EffectNotFoundError,
|
||||
@@ -32,6 +33,17 @@ _PATHS = RendererPaths(
|
||||
app = FastAPI(title="Face SDK Web", version="0.1.0")
|
||||
renderer = FaceRenderer(_PATHS)
|
||||
|
||||
_STATIC_DIR = _SERVER_DIR / "static"
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def index() -> FileResponse:
|
||||
return FileResponse(_STATIC_DIR / "index.html")
|
||||
|
||||
|
||||
# /static/* 提供其它资源(CSS/JS 拆分时用得上;当前 index.html 内联)
|
||||
app.mount("/static", StaticFiles(directory=_STATIC_DIR), name="static")
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health() -> dict:
|
||||
|
||||
Reference in New Issue
Block a user