From 4da3d347412a2b907c23db4ae13ddb5f61398a72 Mon Sep 17 00:00:00 2001 From: Ludovic Anterieur Date: Sat, 29 Jun 2024 13:17:30 +0200 Subject: [PATCH] fix declare now inside get img temp path --- industrial_magick.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/industrial_magick.py b/industrial_magick.py index c76eae2..378548b 100644 --- a/industrial_magick.py +++ b/industrial_magick.py @@ -22,6 +22,7 @@ def read_image_from_path(image_path): return image def get_image_temp_path(): + now = datetime.datetime.now() timestamp = now.strftime("%Y%m%d_%H%M%S") img_file_name = f'ImageMagick_{timestamp}.png' if not os.path.exists(tmp_path): @@ -93,7 +94,6 @@ class IndustrialMagickImageIngest: for (batch_number, ii) in enumerate(image): i = 255. * ii.cpu().numpy() img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8)) - now = datetime.datetime.now() img_full_path = get_image_temp_path() img.save(img_full_path) return (img_full_path,)