Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
2a530d49
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
207
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,发现更多精彩内容 >>
提交
2a530d49
编写于
1月 21, 2022
作者:
W
WilliamZhang06
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
servert dir arch
上级
26524031
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
448 addition
and
0 deletion
+448
-0
speechserving/setup.py
speechserving/setup.py
+0
-0
speechserving/speechserving/__init__.py
speechserving/speechserving/__init__.py
+0
-0
speechserving/speechserving/bin/main.py
speechserving/speechserving/bin/main.py
+39
-0
speechserving/speechserving/bin/paddlespeech-client.py
speechserving/speechserving/bin/paddlespeech-client.py
+39
-0
speechserving/speechserving/bin/paddlespeech-server.py
speechserving/speechserving/bin/paddlespeech-server.py
+39
-0
speechserving/speechserving/conf/application.yaml
speechserving/speechserving/conf/application.yaml
+0
-0
speechserving/speechserving/conf/asr/asr.yaml
speechserving/speechserving/conf/asr/asr.yaml
+0
-0
speechserving/speechserving/controller/api.py
speechserving/speechserving/controller/api.py
+50
-0
speechserving/speechserving/engine/__init__.py
speechserving/speechserving/engine/__init__.py
+0
-0
speechserving/speechserving/engine/asr/python/asr_engine.py
speechserving/speechserving/engine/asr/python/asr_engine.py
+42
-0
speechserving/speechserving/engine/base_engine.py
speechserving/speechserving/engine/base_engine.py
+57
-0
speechserving/speechserving/main.py
speechserving/speechserving/main.py
+43
-0
speechserving/speechserving/restful/__init__.py
speechserving/speechserving/restful/__init__.py
+0
-0
speechserving/speechserving/restful/api.py
speechserving/speechserving/restful/api.py
+31
-0
speechserving/speechserving/restful/request.py
speechserving/speechserving/restful/request.py
+56
-0
speechserving/speechserving/restful/response.py
speechserving/speechserving/restful/response.py
+52
-0
未找到文件。
speechserving/setup.py
0 → 100644
浏览文件 @
2a530d49
speechserving/speechserving/__init__.py
0 → 100644
浏览文件 @
2a530d49
speechserving/speechserving/bin/main.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
argparse
def
init
(
args
):
""" 系统初始化
"""
def
main
(
args
):
"""主程序入口"""
if
init
(
args
):
app
.
run
(
host
=
'0.0.0.0'
,
port
=
conf
.
port
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--config_file"
,
action
=
"store"
,
help
=
"yaml file of the app"
,
default
=
"./conf/application.yaml"
)
parser
.
add_argument
(
"--log_file"
,
action
=
"store"
,
help
=
"log file"
,
default
=
"./log/paddlespeech.log"
)
args
=
parser
.
parse_args
()
main
(
args
)
speechserving/speechserving/bin/paddlespeech-client.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
argparse
def
init
(
args
):
""" 系统初始化
"""
def
main
(
args
):
"""主程序入口"""
if
init
(
args
):
app
.
run
(
host
=
'0.0.0.0'
,
port
=
conf
.
port
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--config_file"
,
action
=
"store"
,
help
=
"yaml file of the app"
,
default
=
"./conf/application.yaml"
)
parser
.
add_argument
(
"--log_file"
,
action
=
"store"
,
help
=
"log file"
,
default
=
"./log/paddlespeech.log"
)
args
=
parser
.
parse_args
()
main
(
args
)
speechserving/speechserving/bin/paddlespeech-server.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
argparse
def
init
(
args
):
""" 系统初始化
"""
def
main
(
args
):
"""主程序入口"""
if
init
(
args
):
app
.
run
(
host
=
'0.0.0.0'
,
port
=
conf
.
port
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--config_file"
,
action
=
"store"
,
help
=
"yaml file of the app"
,
default
=
"./conf/application.yaml"
)
parser
.
add_argument
(
"--log_file"
,
action
=
"store"
,
help
=
"log file"
,
default
=
"./log/paddlespeech.log"
)
args
=
parser
.
parse_args
()
main
(
args
)
speechserving/speechserving/conf/application.yaml
0 → 100644
浏览文件 @
2a530d49
speechserving/speechserving/conf/asr/asr.yaml
0 → 100644
浏览文件 @
2a530d49
speechserving/speechserving/controller/api.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
fastapi
import
APIRouter
router
=
APIRouter
()
router
.
include_router
(
auth_router
)
router
.
include_router
(
user_router
)
router
.
include_router
(
profile_router
)
router
.
include_router
(
comment_router
)
router
.
include_router
(
article_router
)
router
.
include_router
(
tag_router
)
def
init_app
(
app
):
asr
,
tts
if
asr
backend
dyload
(
asr
)
asr
.
register_router
(
router
)
if
tts
backend
dyload
(
asr
)
asr
.
register_router
(
router
)
app
.
include_router
(
router
)
speechserving/speechserving/engine/__init__.py
0 → 100644
浏览文件 @
2a530d49
speechserving/speechserving/engine/asr/python/asr_engine.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
engine
import
BaseEngine
__all__
=
[
'ASREngine'
]
class
ASREngine
(
BaseEngine
):
def
__init__
(
self
,
name
):
super
(
ASREngine
,
self
).
__init__
()
def
init
(
self
):
pass
def
postprocess
(
self
):
pass
def
run
(
self
):
pass
if
__name__
==
"__main__"
:
# test Singleton
class1
=
ASREngine
(
"ASREngine"
)
class2
=
ASREngine
()
print
(
class1
is
class2
)
print
(
id
(
class1
))
print
(
id
(
class2
))
speechserving/speechserving/engine/base_engine.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
from
typing
import
Any
from
typing
import
List
from
typing
import
Union
from
pattern_singleton
import
Singleton
class
BaseEngine
(
metaclass
=
Singleton
):
"""
An base engine class
"""
def
__init__
(
self
):
self
.
_inputs
=
dict
()
self
.
_outputs
=
dict
()
def
init
(
self
,
*
args
,
**
kwargs
):
"""
init the engine
Returns:
bool: true or false
"""
pass
def
postprocess
(
self
,
*
args
,
**
kwargs
)
->
Union
[
str
,
os
.
PathLike
]:
"""
Output postprocess and return results.
This method get model output from self._outputs and convert it into human-readable results.
Returns:
Union[str, os.PathLike]: Human-readable results such as texts and audio files.
"""
pass
def
run
(
self
,
*
args
,
**
kwargs
)
->
Union
[
str
,
os
.
PathLike
]:
"""
Output postprocess and return results.
This method get model output from self._outputs and convert it into human-readable results.
Returns:
Union[str, os.PathLike]: Human-readable results such as texts and audio files.
"""
pass
speechserving/speechserving/main.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
argparse
import
asr_api
as
api_run
import
tts_api
as
api_run
def
init
(
args
):
""" 系统初始化
"""
def
main
(
args
):
"""主程序入口"""
if
init
(
args
):
api_run
.
run
()
app
.
run
(
host
=
'0.0.0.0'
,
port
=
conf
.
port
)
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--config_file"
,
action
=
"store"
,
help
=
"yaml file of the app"
,
default
=
"./conf/application.yaml"
)
parser
.
add_argument
(
"--log_file"
,
action
=
"store"
,
help
=
"log file"
,
default
=
"./log/paddlespeech.log"
)
args
=
parser
.
parse_args
()
main
(
args
)
speechserving/speechserving/restful/__init__.py
0 → 100644
浏览文件 @
2a530d49
speechserving/speechserving/restful/api.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
fastapi
import
APIRouter
router
=
APIRouter
()
router
.
include_router
(
auth_router
)
router
.
include_router
(
user_router
)
router
.
include_router
(
profile_router
)
router
.
include_router
(
comment_router
)
router
.
include_router
(
article_router
)
router
.
include_router
(
tag_router
)
def
init_app
(
app
):
app
.
include_router
(
router
)
speechserving/speechserving/restful/request.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
typing
import
Optional
from
typing
import
List
from
pydantic
import
BaseModel
__all__
=
[
'ASRRequest, TTSRequest'
]
#****************************************************************************************/
#************************************ ASR request ***************************************/
#****************************************************************************************/
class
ASRRequest
(
BaseModel
):
"""
request body example
{
"audio": "exSI6ICJlbiIsCgkgICAgInBvc2l0aW9uIjogImZhbHNlIgoJf...",
"audio_format": "wav",
"sample_rate": 16000,
"lang ": "zh_cn",
"ptt ":false
}
"""
audio
:
str
audio_format
:
str
sample_rate
:
int
lang
:
str
ptt
:
Optional
[
bool
]
=
None
#****************************************************************************************/
#************************************ TTS request ***************************************/
#****************************************************************************************/
class
TTSRequest
(
BaseModel
):
"""
request body example
{
"audio": "exSI6ICJlbiIsCgkgICAgInBvc2l0aW9uIjogImZhbHNlIgoJf...",
"audio_format": "wav",
"sample_rate": 16000,
"lang ": "zh_cn",
"ptt ":false
}
"""
\ No newline at end of file
speechserving/speechserving/restful/response.py
0 → 100644
浏览文件 @
2a530d49
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
typing
import
Optional
from
typing
import
List
from
pydantic
import
BaseModel
__all__
=
[
'ASRResponse'
]
class
Message
(
BaseModel
):
description
:
str
#****************************************************************************************/
#************************************ ASR response **************************************/
#****************************************************************************************/
class
AsrResult
(
BaseModel
):
transcription
:
str
class
ASRResponse
(
BaseModel
):
"""
response example
{
"success": true,
"code": 0,
"message": {
"description": "success"
}
"result": {
"transcription": "你好,飞桨"
}
}
"""
success
:
bool
code
:
int
message
:
Message
result
:
AsrResult
#****************************************************************************************/
#************************************ TTS response **************************************/
#****************************************************************************************/
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录