From 8a622f00b36dea4f604dadd1dc977ee4bf2e30db Mon Sep 17 00:00:00 2001 From: vik Date: Thu, 5 Dec 2024 00:09:39 -0800 Subject: [PATCH] handle non-RGB images --- clients/python/moondream/preprocess.py | 2 ++ clients/python/pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/clients/python/moondream/preprocess.py b/clients/python/moondream/preprocess.py index 933d482..e5ae459 100644 --- a/clients/python/moondream/preprocess.py +++ b/clients/python/moondream/preprocess.py @@ -78,6 +78,8 @@ def create_patches( resolution. Returns the patches as a numpy array, and the selected patching template as a tuple of (rows, cols). """ + image = image.convert("RGB") + # Start off with the global patch. patches = [im_resize(image, (image_patch_size, image_patch_size))] diff --git a/clients/python/pyproject.toml b/clients/python/pyproject.toml index 3279f70..7b1cc58 100644 --- a/clients/python/pyproject.toml +++ b/clients/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "moondream" -version = "0.0.4" +version = "0.0.5" description = "Python client library for moondream" authors = ["vik "] readme = "README.md"