Fix wrong result due to wrong break filenames

This commit is contained in:
Viet Anh Nguyen 2023-12-15 15:00:43 +07:00
parent 8d12826d44
commit 4c5487f7af

View File

@ -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)