From b4a10844fcf0be94e9a0d31758f48ee93bd50c05 Mon Sep 17 00:00:00 2001 From: awwaawwa <8493196+awwaawwa@users.noreply.github.com> Date: Tue, 24 Dec 2024 02:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20feat(high=5Flevel):=20deco?= =?UTF-8?q?uple=20translation=20from=20typesetting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pdf2zh/high_level.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pdf2zh/high_level.py b/pdf2zh/high_level.py index f3eafee0..544063fd 100644 --- a/pdf2zh/high_level.py +++ b/pdf2zh/high_level.py @@ -10,6 +10,7 @@ from pathlib import Path from typing import Any, BinaryIO, List, Optional import concurrent.futures +import time import numpy as np import requests @@ -371,7 +372,7 @@ def translate( if file.startswith(tempfile.gettempdir()): os.unlink(file) - + generate_cache_start = time.time() with concurrent.futures.ThreadPoolExecutor( max_workers=thread ) as executor: @@ -383,6 +384,9 @@ def translate( **locals(), ) print('Translating... Please wait...') + print( + f"Generate cache time: {time.time() - generate_cache_start:.2f} seconds" + ) s_mono, s_dual = translate_stream( s_raw, envs=kwarg.get("envs", {}),