From 5110ad6062466ca1b7a79d210e072c78094fe3c1 Mon Sep 17 00:00:00 2001 From: mertalev <101130780+mertalev@users.noreply.github.com> Date: Tue, 2 Jun 2026 12:25:19 -0400 Subject: [PATCH] fix deprecation log --- machine-learning/immich_ml/main.py | 3 ++- machine-learning/immich_ml/schemas.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/machine-learning/immich_ml/main.py b/machine-learning/immich_ml/main.py index 54f9a53930..4ac5b020ae 100644 --- a/machine-learning/immich_ml/main.py +++ b/machine-learning/immich_ml/main.py @@ -12,7 +12,7 @@ from zipfile import BadZipFile import orjson from fastapi import Depends, FastAPI, File, Form, HTTPException -from fastapi.responses import ORJSONResponse, PlainTextResponse +from fastapi.responses import PlainTextResponse from onnxruntime.capi.onnxruntime_pybind11_state import InvalidProtobuf, NoSuchFile from PIL.Image import Image from pydantic import ValidationError @@ -32,6 +32,7 @@ from .schemas import ( ModelIdentity, ModelTask, ModelType, + ORJSONResponse, PipelineRequest, T, ) diff --git a/machine-learning/immich_ml/schemas.py b/machine-learning/immich_ml/schemas.py index 41706180de..d5304cf763 100644 --- a/machine-learning/immich_ml/schemas.py +++ b/machine-learning/immich_ml/schemas.py @@ -3,9 +3,16 @@ from typing import Any, Literal, Protocol, TypeGuard, TypeVar import numpy as np import numpy.typing as npt +import orjson +from fastapi.responses import JSONResponse from typing_extensions import TypedDict +class ORJSONResponse(JSONResponse): + def render(self, content: Any) -> bytes: + return orjson.dumps(content, option=orjson.OPT_SERIALIZE_NUMPY) + + class StrEnum(str, Enum): value: str