Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
77bad44e
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
12 个月 前同步成功
通知
205
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
77bad44e
编写于
3月 10, 2022
作者:
L
lym0302
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify readme, test=doc
上级
8ef92a94
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
16 deletion
+31
-16
demos/speech_server/README.md
demos/speech_server/README.md
+14
-8
demos/speech_server/README_cn.md
demos/speech_server/README_cn.md
+14
-7
paddlespeech/server/restful/response.py
paddlespeech/server/restful/response.py
+3
-1
未找到文件。
demos/speech_server/README.md
浏览文件 @
77bad44e
...
...
@@ -110,21 +110,22 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
ASRClientExecutor
import
json
asrclient_executor
=
ASRClientExecutor
()
asrclient_executor
(
res
=
asrclient_executor
(
input
=
"./zh.wav"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
sample_rate
=
16000
,
lang
=
"zh_cn"
,
audio_format
=
"wav"
)
print
(
res
.
json
())
```
Output:
```
bash
{
'success'
: True,
'code'
: 200,
'message'
:
{
'description'
:
'success'
}
,
'result'
:
{
'transcription'
:
'我认为跑步最重要的就是给我带来了身体健康'
}}
time
cost 0.604353 s.
```
### 5. TTS Client Usage
...
...
@@ -146,7 +147,7 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
-
`speed`
: Audio speed, the value should be set between 0 and 3. Default: 1.0
-
`volume`
: Audio volume, the value should be set between 0 and 3. Default: 1.0
-
`sample_rate`
: Sampling rate, choice: [0, 8000, 16000], the default is the same as the model. Default: 0
-
`output`
: Output wave filepath. Default:
`output.wav`
.
-
`output`
: Output wave filepath. Default:
None, which means not to save the audio to the local
.
Output:
```bash
...
...
@@ -160,9 +161,10 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
TTSClientExecutor
import
json
ttsclient_executor
=
TTSClientExecutor
()
ttsclient_executor
(
res
=
ttsclient_executor
(
input
=
"您好,欢迎使用百度飞桨语音合成服务。"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
...
...
@@ -171,6 +173,11 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
volume
=
1.0
,
sample_rate
=
0
,
output
=
"./output.wav"
)
response_dict
=
res
.
json
()
print
(
response_dict
[
"message"
])
print
(
"Save synthesized audio successfully on %s."
%
(
response_dict
[
'result'
][
'save_path'
]))
print
(
"Audio duration: %f s."
%
(
response_dict
[
'result'
][
'duration'
]))
```
Output:
...
...
@@ -178,7 +185,6 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
{
'description'
:
'success.'
}
Save synthesized audio successfully on ./output.wav.
Audio duration: 3.612500 s.
Response
time
: 0.388317 s.
```
...
...
@@ -211,20 +217,20 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
CLSClientExecutor
import
json
clsclient_executor
=
CLSClientExecutor
()
clsclient_executor
(
res
=
clsclient_executor
(
input
=
"./zh.wav"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
topk
=
1
)
print
(
res
.
jaon
())
```
Output:
```
bash
{
'success'
: True,
'code'
: 200,
'message'
:
{
'description'
:
'success'
}
,
'result'
:
{
'topk'
: 1,
'results'
:
[{
'class_name'
:
'Speech'
,
'prob'
: 0.9027184844017029
}]}}
Response
time
0.150897 s.
```
...
...
demos/speech_server/README_cn.md
浏览文件 @
77bad44e
...
...
@@ -111,21 +111,22 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
ASRClientExecutor
import
json
asrclient_executor
=
ASRClientExecutor
()
asrclient_executor
(
res
=
asrclient_executor
(
input
=
"./zh.wav"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
sample_rate
=
16000
,
lang
=
"zh_cn"
,
audio_format
=
"wav"
)
print
(
res
.
json
())
```
输出:
```
bash
{
'success'
: True,
'code'
: 200,
'message'
:
{
'description'
:
'success'
}
,
'result'
:
{
'transcription'
:
'我认为跑步最重要的就是给我带来了身体健康'
}}
time
cost 0.604353 s.
```
...
...
@@ -150,7 +151,7 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
- `speed`: 音频速度,该值应设置在 0 到 3 之间。 默认值:1.0
- `volume`: 音频音量,该值应设置在 0 到 3 之间。 默认值: 1.0
- `sample_rate`: 采样率,可选 [0, 8000, 16000],默认与模型相同。 默认值:0
- `output`: 输出音频的路径, 默认值:
output.wav
。
- `output`: 输出音频的路径, 默认值:
None,表示不保存音频到本地
。
输出:
```bash
...
...
@@ -163,9 +164,10 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
TTSClientExecutor
import
json
ttsclient_executor
=
TTSClientExecutor
()
ttsclient_executor
(
res
=
ttsclient_executor
(
input
=
"您好,欢迎使用百度飞桨语音合成服务。"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
...
...
@@ -174,6 +176,11 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
volume
=
1.0
,
sample_rate
=
0
,
output
=
"./output.wav"
)
response_dict
=
res
.
json
()
print
(
response_dict
[
"message"
])
print
(
"Save synthesized audio successfully on %s."
%
(
response_dict
[
'result'
][
'save_path'
]))
print
(
"Audio duration: %f s."
%
(
response_dict
[
'result'
][
'duration'
]))
```
输出:
...
...
@@ -181,7 +188,6 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
{
'description'
:
'success.'
}
Save synthesized audio successfully on ./output.wav.
Audio duration: 3.612500 s.
Response
time
: 0.388317 s.
```
...
...
@@ -214,20 +220,21 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav https://paddlespee
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
CLSClientExecutor
import
json
clsclient_executor
=
CLSClientExecutor
()
clsclient_executor
(
res
=
clsclient_executor
(
input
=
"./zh.wav"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
topk
=
1
)
print
(
res
.
jaon
())
```
输出:
```
bash
{
'success'
: True,
'code'
: 200,
'message'
:
{
'description'
:
'success'
}
,
'result'
:
{
'topk'
: 1,
'results'
:
[{
'class_name'
:
'Speech'
,
'prob'
: 0.9027184844017029
}]}}
Response
time
0.150897 s.
```
...
...
paddlespeech/server/restful/response.py
浏览文件 @
77bad44e
...
...
@@ -74,9 +74,11 @@ class TTSResponse(BaseModel):
},
"result": {
"lang": "zh",
"s
ample_rate": 2400
0,
"s
pk_id":
0,
"speed": 1.0,
"volume": 1.0,
"sample_rate": 24000,
"duration": 3.6125,
"audio": "LTI1OTIuNjI1OTUwMzQsOTk2OS41NDk4...",
"save_path": "./tts.wav"
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录