Skip to content

Commit e0dd214

Browse files
authored
Update baidu_voice.py
1 parent 814ce7a commit e0dd214

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

voice/baidu/baidu_voice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ def _long_text_synthesis(self, text):
115115

116116
# 轮询查询任务状态
117117
query_url = f"https://aip.baidubce.com/rpc/2.0/tts/v1/query?access_token={token}"
118-
for _ in range(30):
119-
time.sleep(1.5)
118+
for _ in range(100):
119+
time.sleep(3)
120120
resp = requests.post(query_url, headers=headers, json={"task_ids":[task_id]})
121121
result = resp.json()
122122
infos = result.get("tasks_info") or result.get("tasks") or []
@@ -148,7 +148,7 @@ def textToVoice(self, text):
148148
try:
149149
# GBK 编码字节长度
150150
gbk_len = len(text.encode("gbk", errors="ignore"))
151-
if gbk_len <= 120:
151+
if gbk_len <= 1024:
152152
# 短文本走 SDK 合成
153153
result = self.client.synthesis(
154154
text, self.lang, self.ctp,

0 commit comments

Comments
 (0)