move dir, test=doc

pull/1454/head
lym0302 2 years ago
parent 76391275fc
commit 07158b2f12

@ -16,10 +16,10 @@ import uvicorn
import yaml
from fastapi import FastAPI
from engine.engine_factory import EngineFactory
from restful.api import setup_router
from utils.config import get_config
from utils.log import logger
from paddlespeech.server.engine.engine_factory import EngineFactory
from paddlespeech.server.restful.api import setup_router
from paddlespeech.server.utils.config import get_config
from paddlespeech.server.utils.log import logger
app = FastAPI(
title="PaddleSpeech Serving API", description="Api", version="0.0.1")

@ -12,6 +12,6 @@ port: 8090
# add engine type (Options: asr, tts) and config file here.
engine_backend:
#asr: 'conf/asr/asr.yaml'
tts: 'conf/tts/tts.yaml'
asr: 'conf/asr/asr.yaml'
tts: 'conf/tts/tts_pd.yaml'

@ -20,7 +20,6 @@ from typing import Union
import librosa
import paddle
import soundfile
from engine.base_engine import BaseEngine
from paddlespeech.cli.asr.infer import ASRExecutor
from paddlespeech.cli.log import logger
@ -28,7 +27,8 @@ from paddlespeech.s2t.frontend.featurizer.text_featurizer import TextFeaturizer
from paddlespeech.s2t.transform.transformation import Transformation
from paddlespeech.s2t.utils.dynamic_import import dynamic_import
from paddlespeech.s2t.utils.utility import UpdateConfig
from utils.config import get_config
from paddlespeech.server.engine.base_engine import BaseEngine
from paddlespeech.server.utils.config import get_config
__all__ = ['ASREngine']

@ -13,8 +13,9 @@
# limitations under the License.
from typing import Text
from engine.asr.python.asr_engine import ASREngine
from engine.tts.python.tts_engine import TTSEngine
from paddlespeech.server.engine.asr.python.asr_engine import ASREngine
#from paddlespeech.server.engine.tts.python.tts_engine import TTSEngine
from paddlespeech.server.engine.tts.paddleinference.tts_engine import TTSEngine
__all__ = ['EngineFactory']

@ -20,7 +20,6 @@ import librosa
import numpy as np
import paddle
import soundfile as sf
from engine.base_engine import BaseEngine
from scipy.io import wavfile
from paddlespeech.cli.log import logger
@ -29,12 +28,13 @@ from paddlespeech.cli.utils import download_and_decompress
from paddlespeech.cli.utils import MODEL_HOME
from paddlespeech.t2s.frontend import English
from paddlespeech.t2s.frontend.zh_frontend import Frontend
from utils.audio_process import change_speed
from utils.config import get_config
from utils.errors import ErrorCode
from utils.exception import ServerBaseException
from utils.paddle_predictor import init_predictor
from utils.paddle_predictor import run_model
from paddlespeech.server.engine.base_engine import BaseEngine
from paddlespeech.server.utils.audio_process import change_speed
from paddlespeech.server.utils.config import get_config
from paddlespeech.server.utils.errors import ErrorCode
from paddlespeech.server.utils.exception import ServerBaseException
from paddlespeech.server.utils.paddle_predictor import init_predictor
from paddlespeech.server.utils.paddle_predictor import run_model
__all__ = ['TTSEngine']

@ -17,15 +17,15 @@ import io
import librosa
import numpy as np
import soundfile as sf
from engine.base_engine import BaseEngine
from scipy.io import wavfile
from paddlespeech.cli.log import logger
from paddlespeech.cli.tts.infer import TTSExecutor
from utils.audio_process import change_speed
from utils.config import get_config
from utils.errors import ErrorCode
from utils.exception import ServerBaseException
from paddlespeech.server.utils.audio_process import change_speed
from paddlespeech.server.engine.base_engine import BaseEngine
from paddlespeech.server.utils.config import get_config
from paddlespeech.server.utils.errors import ErrorCode
from paddlespeech.server.utils.exception import ServerBaseException
__all__ = ['TTSEngine']

@ -15,8 +15,8 @@ from typing import List
from fastapi import APIRouter
from .asr_api import router as asr_router
from .tts_api import router as tts_router
from paddlespeech.server.restful.asr_api import router as asr_router
from paddlespeech.server.restful.tts_api import router as tts_router
_router = APIRouter()

@ -14,16 +14,15 @@
import base64
import traceback
from typing import Union
from engine.asr.python.asr_engine import ASREngine
from fastapi import APIRouter
from .request import ASRRequest
from .response import ASRResponse
from .response import ErrorResponse
from utils.errors import ErrorCode
from utils.errors import failed_response
from utils.exception import ServerBaseException
from paddlespeech.server.engine.asr.python.asr_engine import ASREngine
from paddlespeech.server.restful.request import ASRRequest
from paddlespeech.server.restful.response import ASRResponse
from paddlespeech.server.restful.response import ErrorResponse
from paddlespeech.server.utils.errors import ErrorCode
from paddlespeech.server.utils.errors import failed_response
from paddlespeech.server.utils.exception import ServerBaseException
router = APIRouter()

@ -13,16 +13,16 @@
# limitations under the License.
import traceback
from typing import Union
from engine.tts.python.tts_engine import TTSEngine
from fastapi import APIRouter
from .request import TTSRequest
from .response import ErrorResponse
from .response import TTSResponse
from utils.errors import ErrorCode
from utils.errors import failed_response
from utils.exception import ServerBaseException
#from paddlespeech.server.engine.tts.python.tts_engine import TTSEngine
from paddlespeech.server.engine.tts.paddleinference.tts_engine import TTSEngine
from paddlespeech.server.restful.request import TTSRequest
from paddlespeech.server.restful.response import ErrorResponse
from paddlespeech.server.restful.response import TTSResponse
from paddlespeech.server.utils.errors import ErrorCode
from paddlespeech.server.utils.errors import failed_response
from paddlespeech.server.utils.exception import ServerBaseException
router = APIRouter()

@ -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.

@ -1,25 +0,0 @@
# 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`

@ -1,3 +0,0 @@
export MAIN_ROOT=`realpath ${PWD}/../`
export PYTHONIOENCODING=UTF-8
export PYTHONPATH=${MAIN_ROOT}:${PYTHONPATH}

@ -23,14 +23,7 @@ import numpy as np
import requests
import soundfile
def wav2pcm(wavfile: str, pcmfile: str, data_type=np.int16):
with open(wavfile, "rb") as f:
f.seek(0)
f.read(44)
data = np.fromfile(f, dtype=data_type)
data.tofile(pcmfile)
from paddlespeech.server.utils.audio_process import wav2pcm
# Request and response
def tts_client(args):

@ -13,7 +13,7 @@
# limitations under the License.
import traceback
from utils.errors import ErrorMsg
from paddlespeech.server.utils.errors import ErrorMsg
class ServerBaseException(Exception):
Loading…
Cancel
Save