Skip to content

Commit

Permalink
feat(high_level): set rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
awwaawwa committed Dec 23, 2024
1 parent 0bf5002 commit 394a06e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pdf2zh/high_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from pdf2zh.converter import TranslateConverter
from pdf2zh.doclayout import DocLayoutModel
from pdf2zh.pdfinterp import PDFPageInterpreterEx
from pdf2zh.translator import set_translate_rate_limiter

model = DocLayoutModel.load_available()

Expand Down Expand Up @@ -322,6 +323,7 @@ def translate(
cancellation_event: asyncio.Event = None,
**kwarg: Any,
):
set_translate_rate_limiter(thread)
if not files:
raise PDFValueError("No files to process.")

Expand Down

0 comments on commit 394a06e

Please sign in to comment.