From 9c9224d826aab155c7963ecc891c2e5b10d801d6 Mon Sep 17 00:00:00 2001
From: M Generali <mgenerali@teklia.com>
Date: Tue, 6 Jun 2023 18:13:30 +0200
Subject: [PATCH] resolve threads

---
 dan/predict/prediction.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dan/predict/prediction.py b/dan/predict/prediction.py
index fa4bcea0..64552e96 100644
--- a/dan/predict/prediction.py
+++ b/dan/predict/prediction.py
@@ -299,13 +299,13 @@ def run(
     dan_model = DAN(device, temperature)
     dan_model.load(model, parameters, charset, mode="eval")
 
-    im = read_image(image, scale=scale)
-
     # Load image and pre-process it
     if image_max_width:
-        h, w, c = read_image(image, scale=1).shape
+        _, w, _ = read_image(image, scale=1).shape
         ratio = image_max_width / w
         im = read_image(image, ratio)
+    else:
+        im = read_image(image, scale=scale)
 
     logger.info("Image loaded.")
     im_p = dan_model.preprocess(im)
-- 
GitLab