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", {}),