This commit is contained in:
2026-05-14 17:30:20 +08:00
parent e43171521d
commit 5e6d8046e1
10 changed files with 224 additions and 77 deletions
+2 -1
View File
@@ -24,9 +24,10 @@ def depth(req: DepthRequest):
"""
try:
pil = b64_to_pil_image(req.image_b64).convert("RGB")
w, h = pil.size
predictor = get_depth_predictor()
depth_arr = predictor(pil) # type: ignore[misc]
png_bytes = depth_to_png16_bytes(np.asarray(depth_arr))
png_bytes = depth_to_png16_bytes(np.asarray(depth_arr), target_hw=(h, w))
return Response(content=png_bytes, media_type="image/png")
except Exception as e:
raise HTTPException(status_code=500, detail=str(e)) from e