From 8c4ba209200cd59d9be785ffe1eb3bf1d68fcf4c Mon Sep 17 00:00:00 2001 From: SkyLi Date: Sun, 29 Mar 2026 01:05:28 +0800 Subject: [PATCH] upgrade: infrared-data 0.1.0 -> 0.2.0 Breaking API changes in upstream: - TempFeatureExtractor no longer accepts model_path - Use FaultDiagnoser.diagnose() for detection + temp extraction - Image should be grayscale (matching file-path behavior) --- pyproject.toml | 2 +- src/main.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1ba3df4..05824cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,5 +8,5 @@ dependencies = [ "uvicorn[standard]>=0.30.0", "python-multipart>=0.0.12", "aiofiles>=24.0.0", - "infrared-data @ file://${PROJECT_ROOT}/lib/infrared_data-0.1.0-py3-none-any.whl", + "infrared-data @ file://${PROJECT_ROOT}/lib/infrared_data-0.2.0-py3-none-any.whl", ] diff --git a/src/main.py b/src/main.py index 35003a6..fc4dcbc 100644 --- a/src/main.py +++ b/src/main.py @@ -47,9 +47,9 @@ async def infer(image: UploadFile = File(...)) -> dict: } } """ - # 读取图片内容 + # 读取图片内容(转灰度,与 diagnose.py 对文件路径的处理逻辑一致) contents = await image.read() - img = Image.open(io.BytesIO(contents)).convert("RGB") + img = Image.open(io.BytesIO(contents)).convert("L") img_array = np.array(img) diagnoser = get_diagnoser()