2026-05-18-19-19-36 修复样例加载提示和favicon
This commit is contained in:
@@ -8,7 +8,7 @@ from typing import Any
|
||||
import cv2
|
||||
from fastapi import FastAPI, File, Form, HTTPException, UploadFile
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import FileResponse
|
||||
from fastapi.responses import FileResponse, Response
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from backend.segmentation import METHOD_DESCRIPTIONS, compare_frame, segment_frame
|
||||
@@ -70,6 +70,15 @@ def samples() -> dict[str, Any]:
|
||||
return {"samples": items}
|
||||
|
||||
|
||||
@app.get("/favicon.ico", include_in_schema=False)
|
||||
def favicon() -> Response:
|
||||
svg = """<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<rect width="64" height="64" rx="12" fill="#10211d"/>
|
||||
<path d="M18 40V18h6v22h-6Zm14 0c-4.9 0-8.2-2.4-8.5-6.4h5.8c.3 1.4 1.4 2.2 3.1 2.2 1.6 0 2.6-.6 2.6-1.8 0-1.3-1.3-1.6-4.3-2.3-3.4-.8-6.6-2-6.6-6.5 0-4.3 3.3-7.2 8.1-7.2 4.7 0 7.8 2.4 8.2 6.4h-5.7c-.2-1.2-1.1-1.9-2.6-1.9-1.4 0-2.3.6-2.3 1.7 0 1.1 1.2 1.5 3.8 2.1 3.8.9 7.2 2.1 7.2 6.9 0 4.2-3.4 6.8-8.8 6.8Z" fill="#38d8b8"/>
|
||||
</svg>"""
|
||||
return Response(content=svg, media_type="image/svg+xml")
|
||||
|
||||
|
||||
def _public(path: Path) -> str:
|
||||
return "/" + path.relative_to(ROOT).as_posix()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user