Skip to content

Commit

Permalink
sleep 0.5s
Browse files Browse the repository at this point in the history
  • Loading branch information
scrpr committed Jul 25, 2024
1 parent 696e163 commit 68c0e28
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import requests
from requests.exceptions import RequestException
from requests.adapters import HTTPAdapter, Retry
import time

def cleanup_ass_file(input_file, output_file):
with open(input_file, encoding='utf-8-sig', mode='r') as f:
Expand Down Expand Up @@ -38,6 +39,7 @@ def traditionalize_text(input_text, user_pre_replace="", user_protect_replace=""
response.raise_for_status()
result = response.json()
if "data" in result and "text" in result["data"]:
time.sleep(0.5)
return result["data"]["text"]
else:
raise Exception("Error: Unexpected response format")
Expand Down

0 comments on commit 68c0e28

Please sign in to comment.