This commit is contained in:
Niko 2024-01-02 14:56:44 +08:00 committed by GitHub
parent 2ccc918337
commit 98e3dd680c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ class CustomAPI(Base):
def translate(self, text):
print(text)
custom_api = self.custom_api
data = {"text": text, "source_lang": self.language, "target_lang": "auto"}
data = {"text": text, "source_lang": "auto", "target_lang": self.language}
post_data = json.dumps(data)
r = requests.post(url=custom_api, data=post_data, timeout=10).text
t_text = json.loads(r)["data"]