23 lines
606 B
Python
23 lines
606 B
Python
|
|
from fastapi import FastAPI
|
|
from .api import router as api_router
|
|
from .database import initialize_database
|
|
|
|
app = FastAPI(
|
|
title="人脸识别服务 V2",
|
|
description="一个健壮、可靠的人脸识别与认证API服务。",
|
|
version="2.0.0"
|
|
)
|
|
|
|
@app.on_event("startup")
|
|
def on_startup():
|
|
"""应用启动时,初始化数据库"""
|
|
initialize_database()
|
|
|
|
# 挂载API路由
|
|
app.include_router(api_router, prefix="/api", tags=["Face Recognition"])
|
|
|
|
@app.get("/", summary="服务健康检查")
|
|
def read_root():
|
|
return {"status": "ok", "message": "欢迎使用人脸识别服务 V2"}
|