From 80801eae63affdbb384dc36433c0019ff857cc2e Mon Sep 17 00:00:00 2001 From: lepi ai <50534209+vxinhao@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=85=E7=BF=BB=E8=AF=91=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- promptsTranslateEN.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/promptsTranslateEN.py b/promptsTranslateEN.py index b1f8606..781f416 100644 --- a/promptsTranslateEN.py +++ b/promptsTranslateEN.py @@ -6,9 +6,9 @@ from hashlib import md5 # 百度翻译api 免费申请地址:https://api.fanyi.baidu.com/ # ----------需要修改成自己的appid和密钥------------ -appid = '20230822001789253' # appid +appid = 'xxxxxx' # appid -secretKey = '1a_B42w3EClH1vnQq8W0' # 密钥 +secretKey = 'xxxxx' # 密钥 #------------------------------------------------ def make_md5(s, encoding='utf-8'): @@ -52,7 +52,7 @@ class translatetoen: salt = random.randint(32768, 65536) sign = make_md5(appid + prompt_text + str(salt) + secretkey) headers = {'Content-Type': 'application/x-www-form-urlencoded'} - payload = {'appid': appid, 'q': prompt_text, 'from': 'auto', 'to': 'en', 'salt': salt, 'sign': sign} + payload = {'appid': appid, 'q': prompt_text, 'from': 'zh', 'to': 'en', 'salt': salt, 'sign': sign} response = requests.post(url, params=payload, headers=headers) result = response.json()