mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-07 03:55:30 +00:00
parent
2ccc918337
commit
98e3dd680c
@ -22,7 +22,7 @@ class CustomAPI(Base):
|
|||||||
def translate(self, text):
|
def translate(self, text):
|
||||||
print(text)
|
print(text)
|
||||||
custom_api = self.custom_api
|
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)
|
post_data = json.dumps(data)
|
||||||
r = requests.post(url=custom_api, data=post_data, timeout=10).text
|
r = requests.post(url=custom_api, data=post_data, timeout=10).text
|
||||||
t_text = json.loads(r)["data"]
|
t_text = json.loads(r)["data"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user