From bc18adae9367062001d145bb65a5d7cdec3687b3 Mon Sep 17 00:00:00 2001 From: Kelly Jerrell Date: Wed, 24 Sep 2025 09:44:49 -0700 Subject: [PATCH] added a couple error messages --- .gitignore | 1 + src/draw_things.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0bfa6b4..5a7c2c8 100644 --- a/.gitignore +++ b/.gitignore @@ -117,3 +117,4 @@ notes.md /playwright/.cache/ .env /comfyui-dt-grpc-test-data-*/ +fpzip_test.py diff --git a/src/draw_things.py b/src/draw_things.py index 1d9a254..7853b09 100644 --- a/src/draw_things.py +++ b/src/draw_things.py @@ -225,6 +225,9 @@ async def dt_sampler(inputs: dict): if generated_images: response_images.extend(generated_images) + if len(response_images) == 0: + raise Exception("The Draw Things gRPC server returned no images") + images = [] for img_data in response_images: result = convert_response_image(img_data) @@ -233,12 +236,13 @@ async def dt_sampler(inputs: dict): width = result["width"] height = result["height"] channels = result["channels"] - mode = "RGB" - if channels >= 4: - mode = "RGBA" + mode = "RGBA" if channels == 4 else "RGB" img = Image.frombytes(mode, (width, height), data) image_np = np.array(img) tensor_image = torch.from_numpy(image_np.astype(np.float32) / 255.0) images.append(tensor_image) + if len(images) == 0: + raise Exception("There was an error converting the response image") + return (torch.stack(images),)