Browse Source

fix: handle empty input in prediction logic of predict_formula.py

myhloli 3 tuần trước cách đây
mục cha
commit
b7a8347f45
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      mineru/model/mfr/pp_formulanet_plus_m/predict_formula.py

+ 5 - 2
mineru/model/mfr/pp_formulanet_plus_m/predict_formula.py

@@ -129,8 +129,11 @@ class FormulaRecognizer(BaseOCRV20):
             new_idx: old_idx for new_idx, old_idx in enumerate(sorted_indices)
         }
 
-        # 进行预测
-        rec_formula = self.predict(sorted_images, batch_size)
+        if len(sorted_images) > 0:
+            # 进行预测
+            rec_formula = self.predict(sorted_images, batch_size)
+        else:
+            rec_formula = []
 
         # Restore original order
         unsorted_results = [""] * len(rec_formula)