From 4c5487f7af1394708d663e9bbe60826acbd235fd Mon Sep 17 00:00:00 2001 From: Viet Anh Nguyen Date: Fri, 15 Dec 2023 15:00:43 +0700 Subject: [PATCH] Fix wrong result due to wrong break filenames --- cope2n-api/fwd_api/utils/process.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cope2n-api/fwd_api/utils/process.py b/cope2n-api/fwd_api/utils/process.py index cbedbeb..7a833c9 100644 --- a/cope2n-api/fwd_api/utils/process.py +++ b/cope2n-api/fwd_api/utils/process.py @@ -1,4 +1,5 @@ import os +import uuid import random import string import tempfile @@ -23,7 +24,6 @@ from ..exception.exceptions import InvalidException, NotFoundException, \ from ..models import UserProfile, OcrTemplate, OcrTemplateBox, \ Subscription, SubscriptionRequestFile, SubscriptionRequest from ..celery_worker.client_connector import c_connector -import uuid from celery.utils.log import get_task_logger @@ -411,7 +411,7 @@ def process_image_local_file(file_name: str, file_path: str, request: Subscripti def pdf_to_images_urls(doc_path, request: SubscriptionRequest, user, dpi: int = 300) -> list: pdf_extracted = [] saving_path = FileUtils.get_folder_path(request) - break_file_name = f'break_0.jpg' + break_file_name = f'{os.path.basename(doc_path.name)}_page_0.jpg' saving_path = os.path.join(saving_path, break_file_name) image = get_first_page_pdf(doc_path, 300)