Skip to content

Commit

Permalink
♻️ feat(high_level): decouple translation from typesetting
Browse files Browse the repository at this point in the history
  • Loading branch information
awwaawwa committed Dec 23, 2024
1 parent 261cac6 commit b4a1084
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pdf2zh/high_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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", {}),
Expand Down

0 comments on commit b4a1084

Please sign in to comment.