Bläddra i källkod

feat(magic_pdf): add logging for batch image processing

- Add batch processing logs to track the progress of image analysis
- Display the current batch number, total batches, and the number of processed pages
myhloli 7 månader sedan
förälder
incheckning
afe1b02c3d
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      magic_pdf/model/doc_analyze_by_custom_model.py

+ 4 - 1
magic_pdf/model/doc_analyze_by_custom_model.py

@@ -214,7 +214,10 @@ def batch_doc_analyze(
 
     batch_images = [images_with_extra_info[i:i+batch_size] for i in range(0, len(images_with_extra_info), batch_size)]
     results = []
-    for batch_image in batch_images:
+    processed_images_count = 0
+    for index, batch_image in enumerate(batch_images):
+        processed_images_count += len(batch_image)
+        logger.info(f'Batch {index + 1}/{len(batch_images)}: {processed_images_count} pages/{len(images_with_extra_info)} pages')
         result = may_batch_image_analyze(batch_image, True, show_log, layout_model, formula_enable, table_enable)
         results.extend(result)