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()