update
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user