mirror of
https://github.com/OwO-Network/DeepLX.git
synced 2025-06-08 18:03:25 +00:00
docs: add python call example
This commit is contained in:
parent
d0310450e5
commit
f9f378e7eb
19
README.md
19
README.md
@ -2,7 +2,7 @@
|
|||||||
* @Author: Vincent Young
|
* @Author: Vincent Young
|
||||||
* @Date: 2022-10-18 07:32:29
|
* @Date: 2022-10-18 07:32:29
|
||||||
* @LastEditors: Vincent Young
|
* @LastEditors: Vincent Young
|
||||||
* @LastEditTime: 2023-03-16 20:24:59
|
* @LastEditTime: 2023-03-21 16:55:40
|
||||||
* @FilePath: /DeepLX/README.md
|
* @FilePath: /DeepLX/README.md
|
||||||
* @Telegram: https://t.me/missuo
|
* @Telegram: https://t.me/missuo
|
||||||
*
|
*
|
||||||
@ -124,6 +124,23 @@ systemctl enable deeplx
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Use in Python
|
||||||
|
```python
|
||||||
|
import httpx, json
|
||||||
|
|
||||||
|
deeplx_api = "http://127.0.0.1:1188/translate"
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"text": "Hello World",
|
||||||
|
"source_lang": "EN",
|
||||||
|
"target_lang": "ZH"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_data = json.dumps(data)
|
||||||
|
r = httpx.post(url = deeplx_api, data = post_data).text
|
||||||
|
print(r)
|
||||||
|
```
|
||||||
|
|
||||||
## Backup the Docker Image of zu1k
|
## Backup the Docker Image of zu1k
|
||||||
```shell
|
```shell
|
||||||
docker run -itd -p 1188:80 missuo/deeplx-bk
|
docker run -itd -p 1188:80 missuo/deeplx-bk
|
||||||
|
Loading…
Reference in New Issue
Block a user