Parcourir la source

修复isr bug

fangjiasheng il y a 2 ans
Parent
commit
90eca7466a
2 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 3 0
      format_convert/convert_image.py
  2. 2 0
      isr/isr_interface.py

+ 3 - 0
format_convert/convert_image.py

@@ -86,6 +86,9 @@ def image_process(image_np, image_path, is_from_pdf=False, is_from_docx=False, u
 
     log("into image_preprocess")
     try:
+        if image_np is None:
+            return []
+
         # 整体分辨率限制
         if image_np.shape[0] > 2000 or image_np.shape[1] > 2000:
             h, w = get_best_predict_size2(image_np, threshold=2000)

+ 2 - 0
isr/isr_interface.py

@@ -197,6 +197,8 @@ def _isr():
         result = result.get("image")
         if judge_error_code(result):
             return json.dumps({"image": result})
+        if isinstance(result, list) and result == [1]:
+            return json.dumps({"image": result})
         img_replace = result
 
         # numpy转为可序列化的string