Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
3f804649
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
11 个月 前同步成功
通知
204
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,发现更多精彩内容 >>
提交
3f804649
编写于
4月 27, 2022
作者:
X
xiongxinlei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update the streaming asr readme, test=doc
上级
c5fe1814
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
215 deletion
+14
-215
demos/streaming_asr_server/README.md
demos/streaming_asr_server/README.md
+8
-13
demos/streaming_asr_server/README_cn.md
demos/streaming_asr_server/README_cn.md
+6
-190
paddlespeech/server/bin/paddlespeech_client.py
paddlespeech/server/bin/paddlespeech_client.py
+0
-12
未找到文件。
demos/streaming_asr_server/README.md
浏览文件 @
3f804649
...
...
@@ -31,7 +31,7 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
-
Command Line (Recommended)
```
bash
# start the service
#
in PaddleSpeech/demos/streaming_asr_server
start the service
paddlespeech_server start
--config_file
./conf/ws_conformer_application.yaml
```
...
...
@@ -111,6 +111,7 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
-
Python API
```
python
# in PaddleSpeech/demos/streaming_asr_server directory
from
paddlespeech.server.bin.paddlespeech_server
import
ServerExecutor
server_executor
=
ServerExecutor
()
...
...
@@ -187,18 +188,16 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
### 4. ASR Client Usage
#### 4.2 使用 `paddlespeech_client asr_online`
**Note:**
The response time will be slightly longer when using the client for the first time
-
Command Line (Recommended)
```
# if we use paddlespeech_client asr, we must specify the protocol to websocket
paddlespeech_client asr --server_ip 127.0.0.1 --port 8090 --input ./zh.wav --protocol websocket
paddlespeech_client asr_online --server_ip 127.0.0.1 --port 8090 --input ./zh.wav
```
Usage:
```
bash
paddlespeech_client asr
help
paddlespeech_client asr
_online
help
```
Arguments:
-
`server_ip`
: server ip. Default: 127.0.0.1
...
...
@@ -207,7 +206,6 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
-
`sample_rate`
: Audio ampling rate, default: 16000.
-
`lang`
: Language. Default: "zh_cn".
-
`audio_format`
: Audio format. Default: "wav".
-
`protocol`
: protocol between client and server. Streaming asr must be websocket.
-
`punc.server_ip`
: punctuation server ip. Default: None.
-
`punc.server_port`
: punctuation server port. Default: None.
...
...
@@ -281,18 +279,16 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
ASRClientExecutor
import
json
from
paddlespeech.server.bin.paddlespeech_client
import
ASROnlineClientExecutor
asrclient_executor
=
ASRClientExecutor
()
asrclient_executor
=
ASR
Online
ClientExecutor
()
res
=
asrclient_executor
(
input
=
"./zh.wav"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
sample_rate
=
16000
,
lang
=
"zh_cn"
,
audio_format
=
"wav"
,
protocol
=
"websocket"
)
audio_format
=
"wav"
)
print
(
res
)
```
...
...
@@ -359,5 +355,4 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
[
2022-04-21 15:59:08,016]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:08,024]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:12,883]
[
INFO] - final receive
msg
={
'status'
:
'ok'
,
'signal'
:
'finished'
,
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:12,884]
[
INFO] - 我认为跑步最重要的就是给我带来了身体健康
```
```
\ No newline at end of file
demos/streaming_asr_server/README_cn.md
浏览文件 @
3f804649
...
...
@@ -12,7 +12,7 @@
安装 PaddleSpeech 的详细过程请看
[
安装文档
](
https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/docs/source/install.md
)
。
推荐使用
**paddlepaddle 2.2.1**
或以上版本。
你可以从medium,hard 两
中
方式中选择一种方式安装 PaddleSpeech。
你可以从medium,hard 两
种
方式中选择一种方式安装 PaddleSpeech。
### 2. 准备配置文件
...
...
@@ -26,8 +26,6 @@
*
conformer:
`conf/ws_conformer_application.yaml`
目前服务集成的模型有: DeepSpeech2和conformer模型。
这个 ASR client 的输入应该是一个 WAV 文件(
`.wav`
),并且采样率必须与模型的采样率相同。
...
...
@@ -40,7 +38,7 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
-
命令行 (推荐使用)
```
bash
# 启动服务
#
在 PaddleSpeech/demos/streaming_asr_server 目录
启动服务
paddlespeech_server start
--config_file
./conf/ws_conformer_application.yaml
```
...
...
@@ -120,6 +118,7 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
-
Python API
```
python
# 在 PaddleSpeech/demos/streaming_asr_server 目录
from
paddlespeech.server.bin.paddlespeech_server
import
ServerExecutor
server_executor
=
ServerExecutor
()
...
...
@@ -195,185 +194,6 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
### 4. ASR 客户端使用方法
#### 4.1 使用`paddlespeech_client asr `
**注意:**
初次使用客户端时响应时间会略长
-
命令行 (推荐使用)
```
# 使用 paddlespecch_asr 需要指定传入协议为 websocket
paddlespeech_client asr --server_ip 127.0.0.1 --port 8090 --input ./zh.wav --protocol websocket
```
使用帮助:
```
bash
paddlespeech_client asr
help
```
参数:
- `server_ip`: 服务端ip地址,默认: 127.0.0.1。
- `port`: 服务端口,默认: 8090。
- `input`(必须输入): 用于识别的音频文件。
- `sample_rate`: 音频采样率,默认值:16000。
- `lang`: 模型语言,默认值:zh_cn。
- `audio_format`: 音频格式,默认值:wav。
- `protocol` 指定客户端和服务端之间服务的协议。在流式识别中必须指定 websocket。
- `punc.server_ip` 标点预测服务的ip。默认是None。
- `punc.server_port` 标点预测服务的端口port。默认是None。
输出:
```bash
[2022-04-21 15:59:03,904] [ INFO] - receive msg={"status": "ok", "signal": "server_ready"}
[2022-04-21 15:59:03,960] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:03,973] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:03,987] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,000] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,012] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,024] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,036] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,047] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,607] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,620] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,633] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,645] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,657] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,669] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:04,680] [ INFO] - receive msg={'asr_results': ''}
[2022-04-21 15:59:05,176] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,185] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,192] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,200] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,208] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,216] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,224] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,232] [ INFO] - receive msg={'asr_results': '我认为跑'}
[2022-04-21 15:59:05,724] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的'}
[2022-04-21 15:59:05,732] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的'}
[2022-04-21 15:59:05,740] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的'}
[2022-04-21 15:59:05,747] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的'}
[2022-04-21 15:59:05,755] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的'}
[2022-04-21 15:59:05,763] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的'}
[2022-04-21 15:59:05,770] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的'}
[2022-04-21 15:59:06,271] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,279] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,287] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,294] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,302] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,310] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,318] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,326] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是'}
[2022-04-21 15:59:06,833] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给'}
[2022-04-21 15:59:06,842] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给'}
[2022-04-21 15:59:06,850] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给'}
[2022-04-21 15:59:06,858] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给'}
[2022-04-21 15:59:06,866] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给'}
[2022-04-21 15:59:06,874] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给'}
[2022-04-21 15:59:06,882] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给'}
[2022-04-21 15:59:07,400] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,408] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,416] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,424] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,432] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,440] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,447] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,455] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了'}
[2022-04-21 15:59:07,984] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了身体健康'}
[2022-04-21 15:59:07,992] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了身体健康'}
[2022-04-21 15:59:08,001] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了身体健康'}
[2022-04-21 15:59:08,008] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了身体健康'}
[2022-04-21 15:59:08,016] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了身体健康'}
[2022-04-21 15:59:08,024] [ INFO] - receive msg={'asr_results': '我认为跑步最重要的就是给我带来了身体健康'}
[2022-04-21 15:59:12,883] [ INFO] - final receive msg={'status': 'ok', 'signal': 'finished', 'asr_results': '我认为跑步最重要的就是给我带来了身体健康'}
[2022-04-21 15:59:12,884] [ INFO] - 我认为跑步最重要的就是给我带来了身体健康
[2022-04-21 15:59:12,884] [ INFO] - Response time 9.051567 s.
```
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
ASRClientExecutor
import
json
asrclient_executor
=
ASRClientExecutor
()
res
=
asrclient_executor
(
input
=
"./zh.wav"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
sample_rate
=
16000
,
lang
=
"zh_cn"
,
audio_format
=
"wav"
,
protocol
=
"websocket"
)
print
(
res
)
```
输出:
```
bash
[
2022-04-21 15:59:03,904]
[
INFO] - receive
msg
={
"status"
:
"ok"
,
"signal"
:
"server_ready"
}
[
2022-04-21 15:59:03,960]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:03,973]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:03,987]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,000]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,012]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,024]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,036]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,047]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,607]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,620]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,633]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,645]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,657]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,669]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:04,680]
[
INFO] - receive
msg
={
'asr_results'
:
''
}
[
2022-04-21 15:59:05,176]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,185]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,192]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,200]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,208]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,216]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,224]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,232]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑'
}
[
2022-04-21 15:59:05,724]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的'
}
[
2022-04-21 15:59:05,732]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的'
}
[
2022-04-21 15:59:05,740]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的'
}
[
2022-04-21 15:59:05,747]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的'
}
[
2022-04-21 15:59:05,755]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的'
}
[
2022-04-21 15:59:05,763]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的'
}
[
2022-04-21 15:59:05,770]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的'
}
[
2022-04-21 15:59:06,271]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,279]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,287]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,294]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,302]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,310]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,318]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,326]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是'
}
[
2022-04-21 15:59:06,833]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给'
}
[
2022-04-21 15:59:06,842]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给'
}
[
2022-04-21 15:59:06,850]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给'
}
[
2022-04-21 15:59:06,858]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给'
}
[
2022-04-21 15:59:06,866]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给'
}
[
2022-04-21 15:59:06,874]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给'
}
[
2022-04-21 15:59:06,882]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给'
}
[
2022-04-21 15:59:07,400]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,408]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,416]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,424]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,432]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,440]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,447]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,455]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了'
}
[
2022-04-21 15:59:07,984]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:07,992]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:08,001]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:08,008]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:08,016]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:08,024]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:12,883]
[
INFO] - final receive
msg
={
'status'
:
'ok'
,
'signal'
:
'finished'
,
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:12,884]
[
INFO] - 我认为跑步最重要的就是给我带来了身体健康
```
#### 4.2 使用 `paddlespeech_client asr_online`
**注意:**
初次使用客户端时响应时间会略长
-
命令行 (推荐使用)
```
...
...
@@ -394,7 +214,6 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
- `sample_rate`: 音频采样率,默认值:16000。
- `lang`: 模型语言,默认值:zh_cn。
- `audio_format`: 音频格式,默认值:wav。
- `protocol` 指定客户端和服务端之间服务的协议。在流式识别中必须指定 websocket。
- `punc.server_ip` 标点预测服务的ip。默认是None。
- `punc.server_port` 标点预测服务的端口port。默认是None。
...
...
@@ -468,18 +287,16 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
-
Python API
```
python
from
paddlespeech.server.bin.paddlespeech_client
import
ASRClientExecutor
import
json
from
paddlespeech.server.bin.paddlespeech_client
import
ASROnlineClientExecutor
asrclient_executor
=
ASRClientExecutor
()
asrclient_executor
=
ASR
Online
ClientExecutor
()
res
=
asrclient_executor
(
input
=
"./zh.wav"
,
server_ip
=
"127.0.0.1"
,
port
=
8090
,
sample_rate
=
16000
,
lang
=
"zh_cn"
,
audio_format
=
"wav"
,
protocol
=
"websocket"
)
audio_format
=
"wav"
)
print
(
res
)
```
...
...
@@ -546,5 +363,4 @@ wget -c https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav
[
2022-04-21 15:59:08,016]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:08,024]
[
INFO] - receive
msg
={
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:12,883]
[
INFO] - final receive
msg
={
'status'
:
'ok'
,
'signal'
:
'finished'
,
'asr_results'
:
'我认为跑步最重要的就是给我带来了身体健康'
}
[
2022-04-21 15:59:12,884]
[
INFO] - 我认为跑步最重要的就是给我带来了身体健康
```
paddlespeech/server/bin/paddlespeech_client.py
浏览文件 @
3f804649
...
...
@@ -377,18 +377,6 @@ class ASRClientExecutor(BaseExecutor):
res
=
handler
.
run
(
input
,
audio_format
,
sample_rate
,
lang
)
res
=
res
[
'result'
][
'transcription'
]
logger
.
info
(
"asr http client finished"
)
elif
protocol
.
lower
()
==
"websocket"
:
logger
.
info
(
"asr websocket client start"
)
handler
=
ASRWsAudioHandler
(
server_ip
,
port
,
punc_server_ip
=
punc_server_ip
,
punc_server_port
=
punc_server_port
)
loop
=
asyncio
.
get_event_loop
()
res
=
loop
.
run_until_complete
(
handler
.
run
(
input
))
res
=
res
[
'result'
]
logger
.
info
(
"asr websocket client finished"
)
else
:
logger
.
error
(
f
"Sorry, we have not support protocol:
{
protocol
}
,"
"please use http or websocket protocol"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录