diff --git a/speechserving/setup.py b/paddlespeech/server/setup.py similarity index 100% rename from speechserving/setup.py rename to paddlespeech/server/setup.py diff --git a/paddlespeech/server/speechserving/README.md b/paddlespeech/server/speechserving/README.md new file mode 100644 index 00000000..d3cf2cc6 --- /dev/null +++ b/paddlespeech/server/speechserving/README.md @@ -0,0 +1,25 @@ +# PaddleSpeech Server + +## The environment variables +The path.sh contains the environment variable. +```bash +source ./bin/path.sh +``` + +## Add engine_backend on conf/application.yaml +``` +engine_backend: + asr: 'conf/asr/asr.yaml' + [server name]: [conf yaml file] +``` +Currently supporting asr and tts services. + +## Start service(command line todo) +```bash +python ./bin/main.py +``` + +## Client access +Refer to `../tests` + + diff --git a/speechserving/speechserving/__init__.py b/paddlespeech/server/speechserving/__init__.py similarity index 100% rename from speechserving/speechserving/__init__.py rename to paddlespeech/server/speechserving/__init__.py diff --git a/speechserving/speechserving/main.py b/paddlespeech/server/speechserving/bin/main.py similarity index 99% rename from speechserving/speechserving/main.py rename to paddlespeech/server/speechserving/bin/main.py index 6d4891c7..2a016cdd 100644 --- a/speechserving/speechserving/main.py +++ b/paddlespeech/server/speechserving/bin/main.py @@ -12,13 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. import argparse - import uvicorn import yaml -from engine.engine_factory import EngineFactory from fastapi import FastAPI -from restful.api import setup_router +from engine.engine_factory import EngineFactory +from restful.api import setup_router from utils.config import get_config from utils.log import logger diff --git a/speechserving/speechserving/bin/paddlespeech-client.py b/paddlespeech/server/speechserving/bin/paddlespeech-client.py similarity index 100% rename from speechserving/speechserving/bin/paddlespeech-client.py rename to paddlespeech/server/speechserving/bin/paddlespeech-client.py diff --git a/speechserving/speechserving/bin/paddlespeech-server.py b/paddlespeech/server/speechserving/bin/paddlespeech-server.py similarity index 100% rename from speechserving/speechserving/bin/paddlespeech-server.py rename to paddlespeech/server/speechserving/bin/paddlespeech-server.py diff --git a/paddlespeech/server/speechserving/bin/path.sh b/paddlespeech/server/speechserving/bin/path.sh new file mode 100644 index 00000000..99278378 --- /dev/null +++ b/paddlespeech/server/speechserving/bin/path.sh @@ -0,0 +1,3 @@ +export MAIN_ROOT=`realpath ${PWD}/../` +export PYTHONIOENCODING=UTF-8 +export PYTHONPATH=${MAIN_ROOT}:${PYTHONPATH} diff --git a/speechserving/speechserving/conf/application.yaml b/paddlespeech/server/speechserving/conf/application.yaml similarity index 95% rename from speechserving/speechserving/conf/application.yaml rename to paddlespeech/server/speechserving/conf/application.yaml index c8d71f2f..9fb67ae5 100644 --- a/speechserving/speechserving/conf/application.yaml +++ b/paddlespeech/server/speechserving/conf/application.yaml @@ -12,6 +12,6 @@ port: 8090 # add engine type (Options: asr, tts) and config file here. engine_backend: - asr: 'conf/asr/asr.yaml' + #asr: 'conf/asr/asr.yaml' tts: 'conf/tts/tts.yaml' diff --git a/speechserving/speechserving/conf/asr/asr.yaml b/paddlespeech/server/speechserving/conf/asr/asr.yaml similarity index 100% rename from speechserving/speechserving/conf/asr/asr.yaml rename to paddlespeech/server/speechserving/conf/asr/asr.yaml diff --git a/speechserving/speechserving/conf/tts/tts.yaml b/paddlespeech/server/speechserving/conf/tts/tts.yaml similarity index 100% rename from speechserving/speechserving/conf/tts/tts.yaml rename to paddlespeech/server/speechserving/conf/tts/tts.yaml diff --git a/speechserving/speechserving/conf/tts/tts_pd.yaml b/paddlespeech/server/speechserving/conf/tts/tts_pd.yaml similarity index 100% rename from speechserving/speechserving/conf/tts/tts_pd.yaml rename to paddlespeech/server/speechserving/conf/tts/tts_pd.yaml diff --git a/speechserving/speechserving/engine/__init__.py b/paddlespeech/server/speechserving/engine/__init__.py similarity index 100% rename from speechserving/speechserving/engine/__init__.py rename to paddlespeech/server/speechserving/engine/__init__.py diff --git a/speechserving/speechserving/engine/asr/python/asr_engine.py b/paddlespeech/server/speechserving/engine/asr/python/asr_engine.py similarity index 100% rename from speechserving/speechserving/engine/asr/python/asr_engine.py rename to paddlespeech/server/speechserving/engine/asr/python/asr_engine.py diff --git a/speechserving/speechserving/engine/base_engine.py b/paddlespeech/server/speechserving/engine/base_engine.py similarity index 100% rename from speechserving/speechserving/engine/base_engine.py rename to paddlespeech/server/speechserving/engine/base_engine.py diff --git a/speechserving/speechserving/engine/engine_factory.py b/paddlespeech/server/speechserving/engine/engine_factory.py similarity index 100% rename from speechserving/speechserving/engine/engine_factory.py rename to paddlespeech/server/speechserving/engine/engine_factory.py diff --git a/speechserving/speechserving/engine/tts/paddleinference/tts_engine.py b/paddlespeech/server/speechserving/engine/tts/paddleinference/tts_engine.py similarity index 99% rename from speechserving/speechserving/engine/tts/paddleinference/tts_engine.py rename to paddlespeech/server/speechserving/engine/tts/paddleinference/tts_engine.py index 2ab8bcb4..003c99f9 100644 --- a/speechserving/speechserving/engine/tts/paddleinference/tts_engine.py +++ b/paddlespeech/server/speechserving/engine/tts/paddleinference/tts_engine.py @@ -339,7 +339,7 @@ class TTSEngine(BaseEngine): """ super(TTSEngine, self).__init__() - def init(self, config_file: str): + def init(self, config_file: str) -> bool: self.executor = TTSServerExecutor() self.config_file = config_file self.config = get_config(config_file) @@ -361,6 +361,7 @@ class TTSEngine(BaseEngine): voc_predictor_conf=self.config.voc_predictor_conf, ) logger.info("Initialize TTS server engine successfully.") + return True def postprocess(self, wav, diff --git a/speechserving/speechserving/engine/tts/python/tts_engine.py b/paddlespeech/server/speechserving/engine/tts/python/tts_engine.py similarity index 98% rename from speechserving/speechserving/engine/tts/python/tts_engine.py rename to paddlespeech/server/speechserving/engine/tts/python/tts_engine.py index 32a0dca3..f6336ba3 100644 --- a/speechserving/speechserving/engine/tts/python/tts_engine.py +++ b/paddlespeech/server/speechserving/engine/tts/python/tts_engine.py @@ -48,7 +48,7 @@ class TTSEngine(BaseEngine): """ super(TTSEngine, self).__init__() - def init(self, config_file: str): + def init(self, config_file: str) -> bool: self.executor = TTSServerExecutor() self.config_file = config_file self.config = get_config(config_file) @@ -68,6 +68,7 @@ class TTSEngine(BaseEngine): lang=self.config.lang) logger.info("Initialize TTS server engine successfully.") + return True def postprocess(self, wav, diff --git a/speechserving/speechserving/restful/__init__.py b/paddlespeech/server/speechserving/restful/__init__.py similarity index 100% rename from speechserving/speechserving/restful/__init__.py rename to paddlespeech/server/speechserving/restful/__init__.py diff --git a/speechserving/speechserving/restful/api.py b/paddlespeech/server/speechserving/restful/api.py similarity index 100% rename from speechserving/speechserving/restful/api.py rename to paddlespeech/server/speechserving/restful/api.py diff --git a/speechserving/speechserving/restful/asr_api.py b/paddlespeech/server/speechserving/restful/asr_api.py similarity index 100% rename from speechserving/speechserving/restful/asr_api.py rename to paddlespeech/server/speechserving/restful/asr_api.py diff --git a/speechserving/speechserving/restful/request.py b/paddlespeech/server/speechserving/restful/request.py similarity index 100% rename from speechserving/speechserving/restful/request.py rename to paddlespeech/server/speechserving/restful/request.py diff --git a/speechserving/speechserving/restful/response.py b/paddlespeech/server/speechserving/restful/response.py similarity index 100% rename from speechserving/speechserving/restful/response.py rename to paddlespeech/server/speechserving/restful/response.py diff --git a/speechserving/speechserving/restful/tts_api.py b/paddlespeech/server/speechserving/restful/tts_api.py similarity index 100% rename from speechserving/speechserving/restful/tts_api.py rename to paddlespeech/server/speechserving/restful/tts_api.py diff --git a/paddlespeech/server/speechserving/tts.wav b/paddlespeech/server/speechserving/tts.wav new file mode 100644 index 00000000..90c1b354 Binary files /dev/null and b/paddlespeech/server/speechserving/tts.wav differ diff --git a/speechserving/speechserving/utils/__init__.py b/paddlespeech/server/speechserving/utils/__init__.py similarity index 100% rename from speechserving/speechserving/utils/__init__.py rename to paddlespeech/server/speechserving/utils/__init__.py diff --git a/speechserving/speechserving/utils/audio_process.py b/paddlespeech/server/speechserving/utils/audio_process.py similarity index 100% rename from speechserving/speechserving/utils/audio_process.py rename to paddlespeech/server/speechserving/utils/audio_process.py diff --git a/speechserving/speechserving/utils/config.py b/paddlespeech/server/speechserving/utils/config.py similarity index 100% rename from speechserving/speechserving/utils/config.py rename to paddlespeech/server/speechserving/utils/config.py diff --git a/speechserving/speechserving/utils/errors.py b/paddlespeech/server/speechserving/utils/errors.py similarity index 100% rename from speechserving/speechserving/utils/errors.py rename to paddlespeech/server/speechserving/utils/errors.py diff --git a/speechserving/speechserving/utils/exception.py b/paddlespeech/server/speechserving/utils/exception.py similarity index 100% rename from speechserving/speechserving/utils/exception.py rename to paddlespeech/server/speechserving/utils/exception.py diff --git a/speechserving/speechserving/utils/log.py b/paddlespeech/server/speechserving/utils/log.py similarity index 100% rename from speechserving/speechserving/utils/log.py rename to paddlespeech/server/speechserving/utils/log.py diff --git a/speechserving/speechserving/utils/paddle_predictor.py b/paddlespeech/server/speechserving/utils/paddle_predictor.py similarity index 100% rename from speechserving/speechserving/utils/paddle_predictor.py rename to paddlespeech/server/speechserving/utils/paddle_predictor.py diff --git a/speechserving/speechserving/utils/util.py b/paddlespeech/server/speechserving/utils/util.py similarity index 100% rename from speechserving/speechserving/utils/util.py rename to paddlespeech/server/speechserving/utils/util.py diff --git a/speechserving/tests/16_audio.wav b/paddlespeech/server/tests/16_audio.wav similarity index 100% rename from speechserving/tests/16_audio.wav rename to paddlespeech/server/tests/16_audio.wav diff --git a/speechserving/tests/http_client.py b/paddlespeech/server/tests/http_client.py similarity index 100% rename from speechserving/tests/http_client.py rename to paddlespeech/server/tests/http_client.py diff --git a/speechserving/tests/tts/test_client.py b/paddlespeech/server/tests/tts/test_client.py similarity index 100% rename from speechserving/tests/tts/test_client.py rename to paddlespeech/server/tests/tts/test_client.py diff --git a/speechserving/speechserving/bin/main.py b/speechserving/speechserving/bin/main.py deleted file mode 100644 index 97043fd7..00000000 --- a/speechserving/speechserving/bin/main.py +++ /dev/null @@ -1,13 +0,0 @@ -# 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.