Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
9125cb07
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
206
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,发现更多精彩内容 >>
提交
9125cb07
编写于
4月 25, 2022
作者:
X
xiongxinlei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update the ws asr response, final_result to result, test=doc
上级
7007b0ec
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
12 deletion
+10
-12
demos/streaming_asr_server/web/templates/index.html
demos/streaming_asr_server/web/templates/index.html
+2
-2
paddlespeech/server/bin/paddlespeech_client.py
paddlespeech/server/bin/paddlespeech_client.py
+1
-1
paddlespeech/server/utils/audio_handler.py
paddlespeech/server/utils/audio_handler.py
+5
-7
paddlespeech/server/ws/asr_socket.py
paddlespeech/server/ws/asr_socket.py
+2
-2
未找到文件。
demos/streaming_asr_server/web/templates/index.html
浏览文件 @
9125cb07
...
...
@@ -93,7 +93,7 @@
function
parseResult
(
data
)
{
var
data
=
JSON
.
parse
(
data
)
var
result
=
data
.
asr_results
var
result
=
data
.
result
console
.
log
(
result
)
$
(
"
#resultPanel
"
).
html
(
result
)
}
...
...
@@ -152,4 +152,4 @@
</script>
</body>
</html>
\ No newline at end of file
</html>
paddlespeech/server/bin/paddlespeech_client.py
浏览文件 @
9125cb07
...
...
@@ -387,7 +387,7 @@ class ASRClientExecutor(BaseExecutor):
punc_server_port
=
punc_server_port
)
loop
=
asyncio
.
get_event_loop
()
res
=
loop
.
run_until_complete
(
handler
.
run
(
input
))
res
=
res
[
'
final_
result'
]
res
=
res
[
'result'
]
logger
.
info
(
"asr websocket client finished"
)
else
:
logger
.
error
(
f
"Sorry, we have not support protocol:
{
protocol
}
,"
...
...
paddlespeech/server/utils/audio_handler.py
浏览文件 @
9125cb07
...
...
@@ -54,8 +54,6 @@ class TextHttpHandler:
str: punctuation text
"""
if
self
.
server_ip
is
None
or
self
.
port
is
None
:
logger
.
warning
(
"No punctuation server, please input valid ip and port"
)
return
text
request
=
{
"text"
:
text
,
...
...
@@ -141,7 +139,7 @@ class ASRWsAudioHandler:
if
self
.
url
is
None
:
logger
.
error
(
"No
punctuation
server, please input valid ip and port"
)
"No
asr
server, please input valid ip and port"
)
return
""
# 1. send websocket handshake protocal
...
...
@@ -166,9 +164,9 @@ class ASRWsAudioHandler:
await
ws
.
send
(
chunk_data
.
tobytes
())
msg
=
await
ws
.
recv
()
msg
=
json
.
loads
(
msg
)
if
self
.
punc_server
and
len
(
msg
[
"
partial_
result"
])
>
0
:
msg
[
"
partial_
result"
]
=
self
.
punc_server
.
run
(
msg
[
"
partial_
result"
])
if
self
.
punc_server
and
len
(
msg
[
"result"
])
>
0
:
msg
[
"result"
]
=
self
.
punc_server
.
run
(
msg
[
"result"
])
logger
.
info
(
"receive msg={}"
.
format
(
msg
))
# 4. we must send finished signal to the server
...
...
@@ -187,7 +185,7 @@ class ASRWsAudioHandler:
# 5. decode the bytes to str
msg
=
json
.
loads
(
msg
)
if
self
.
punc_server
:
msg
[
"
final_result"
]
=
self
.
punc_server
.
run
(
msg
[
"final_
result"
])
msg
[
"
result"
]
=
self
.
punc_server
.
run
(
msg
[
"
result"
])
logger
.
info
(
"final receive msg={}"
.
format
(
msg
))
result
=
msg
...
...
paddlespeech/server/ws/asr_socket.py
浏览文件 @
9125cb07
...
...
@@ -83,7 +83,7 @@ async def websocket_endpoint(websocket: WebSocket):
resp
=
{
"status"
:
"ok"
,
"signal"
:
"finished"
,
'
final_
result'
:
asr_results
'result'
:
asr_results
}
await
websocket
.
send_json
(
resp
)
break
...
...
@@ -102,7 +102,7 @@ async def websocket_endpoint(websocket: WebSocket):
# return the current period result
# if the engine create the vad instance, this connection will have many period results
resp
=
{
'
partial_
result'
:
asr_results
}
resp
=
{
'result'
:
asr_results
}
await
websocket
.
send_json
(
resp
)
except
WebSocketDisconnect
:
pass
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录