Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,91 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
- 一台电脑或平板
|
| 12 |
-
- 一个腾讯旗下的账号或者手机号
|
| 13 |
-
|
| 14 |
-
### Deploy | 部署
|
| 15 |
-
|
| 16 |
-
在 [https://cloud.tencent.com/](https://cloud.tencent.com/) 注册账号
|
| 17 |
-
|
| 18 |
-
进入云函数控制台:[https://console.cloud.tencent.com/scf/list](https://console.cloud.tencent.com/scf/list)
|
| 19 |
-
|
| 20 |
-
依次点击【新建】->【从头开始】,然后按照以下配置,**没写出来的就不用管,使用默认设置**
|
| 21 |
-
|
| 22 |
-
- 函数类型:Web函数
|
| 23 |
-
- 函数名称:deeplx(名字随便取)
|
| 24 |
-
- 地域:任意(国内也可直连)
|
| 25 |
-
- 运行环境:Nodejs 16.13(或者更高的版本)
|
| 26 |
-
- 高级配置:
|
| 27 |
-
- 内存:64M
|
| 28 |
-
- 执行超时时间:60 秒
|
| 29 |
-
- 请求多并发:5 并发(个人体验下来,2个都行)
|
| 30 |
-
- 日志配置 -> 日志投递:启用(可以选择不开,开的话一个月应该几分钱)
|
| 31 |
-
- 函数代码:本地上传zip包([点我下载 ZIP 包](https://github.com/LegendLeo/deeplx-serverless/releases/download/v1.0.0/dist.zip))
|
| 32 |
-
- 触发器配置(这里可能要创建一个新的触发器):
|
| 33 |
-
- 默认触发器
|
| 34 |
-
- 触发别名/版本:默认流量
|
| 35 |
-
- 请求方法:ANY
|
| 36 |
-
- 发布环境:发布
|
| 37 |
-
- 鉴权方法:免鉴权
|
| 38 |
-
|
| 39 |
-
此时已部署完成,可以点击“完成”按钮,进入【函数管理】,点击【函数代码】,往下拉,找到【访问路径】并复制后续使用
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
### How to use | 如何使用
|
| 43 |
-
|
| 44 |
-
建议搭配浏览器插件沉浸式翻译一同使用,使用的时候需要把访问路径里的 `/release` 部分替换为翻译路径`translate`
|
| 45 |
-
|
| 46 |
-
例如:`https://service-aaaaa.gz.apigw.tencentcs.com/release/` 改为:`https://service-aaaaa.gz.apigw.tencentcs.com/translate`
|
| 47 |
-
|
| 48 |
-
请求示例:
|
| 49 |
-
|
| 50 |
-
``` bash
|
| 51 |
-
curl --location 'https://service-aaaaa.gz.apigw.tencentcs.com/translate' \
|
| 52 |
-
--header 'Content-Type: application/json' \
|
| 53 |
-
--data '{
|
| 54 |
-
"text": "你好,世界",
|
| 55 |
-
"source_lang": "zh",
|
| 56 |
-
"target_lang": "en"
|
| 57 |
-
}'
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
响应示例:
|
| 61 |
-
|
| 62 |
-
``` json
|
| 63 |
-
{
|
| 64 |
-
"code": 200,
|
| 65 |
-
"message": "success",
|
| 66 |
-
"data": "Hello, world.",
|
| 67 |
-
"source_lang": "zh",
|
| 68 |
-
"target_lang": "en",
|
| 69 |
-
"alternatives": ["Hello, World.", "Hello, world!", "Hi, world."]
|
| 70 |
-
}
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
#### 沉浸式翻译设置
|
| 74 |
-
|
| 75 |
-
1. 在浏览器上安装最新的 [沉浸式翻译](https://github.com/immersive-translate/immersive-translate/releases)。
|
| 76 |
-
2. 点击左下角的 "开发者设置"。启用测试版实验功能。
|
| 77 |
-
3. 翻译服务选中 `DeepLX(beta)`
|
| 78 |
-
3. 设置 URL 为刚才获取的访问路径(需带translate)。
|
| 79 |
-
|
| 80 |
-

|
| 81 |
-
|
| 82 |
-
## 自托管
|
| 83 |
-
|
| 84 |
-
尽管本项目是专为 serverless 适配的方案,但是也能使用自己提供服务器进行部署
|
| 85 |
-
|
| 86 |
-
``` bash
|
| 87 |
-
git clone https://github.com/LegendLeo/deeplx-serverless
|
| 88 |
-
cd deeplx-serverless
|
| 89 |
-
npm install
|
| 90 |
-
npm run start
|
| 91 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: DeeplX test
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
sdk_version: latest
|
| 8 |
+
app_file: server.js
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|