|
|
|
@ -33,7 +33,6 @@ from paddlespeech.cli.log import logger
|
|
|
|
|
from paddlespeech.server.utils.audio_handler import ASRWsAudioHandler
|
|
|
|
|
from paddlespeech.server.utils.audio_process import wav2pcm
|
|
|
|
|
from paddlespeech.server.utils.util import compute_delay
|
|
|
|
|
from paddlespeech.server.utils.util import network_reachable
|
|
|
|
|
from paddlespeech.server.utils.util import wav2base64
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
@ -157,12 +156,6 @@ class TTSClientExecutor(BaseExecutor):
|
|
|
|
|
"save_path": output
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Check if the network is reachable
|
|
|
|
|
network = 'http://' + server_ip + ":" + str(port)
|
|
|
|
|
if network_reachable(network) is not True:
|
|
|
|
|
logger.error(f"{network} unreachable, please check the ip address.")
|
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
|
|
res = requests.post(url, json.dumps(request))
|
|
|
|
|
response_dict = res.json()
|
|
|
|
|
if output is not None:
|
|
|
|
@ -264,12 +257,6 @@ class TTSOnlineClientExecutor(BaseExecutor):
|
|
|
|
|
Python API to call an executor.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Check if the network is reachable
|
|
|
|
|
network = 'http://' + server_ip + ":" + str(port)
|
|
|
|
|
if network_reachable(network) is not True:
|
|
|
|
|
logger.error(f"{network} unreachable, please check the ip address.")
|
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
|
|
if protocol == "http":
|
|
|
|
|
logger.info("tts http client start")
|
|
|
|
|
from paddlespeech.server.utils.audio_handler import TTSHttpHandler
|
|
|
|
@ -415,13 +402,6 @@ class ASRClientExecutor(BaseExecutor):
|
|
|
|
|
# and paddlespeech_client asr only support http protocol
|
|
|
|
|
protocol = "http"
|
|
|
|
|
if protocol.lower() == "http":
|
|
|
|
|
# Check if the network is reachable
|
|
|
|
|
network = 'http://' + server_ip + ":" + str(port)
|
|
|
|
|
if network_reachable(network) is not True:
|
|
|
|
|
logger.error(
|
|
|
|
|
f"{network} unreachable, please check the ip address.")
|
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
|
|
from paddlespeech.server.utils.audio_handler import ASRHttpHandler
|
|
|
|
|
logger.info("asr http client start")
|
|
|
|
|
handler = ASRHttpHandler(server_ip=server_ip, port=port)
|
|
|
|
@ -527,12 +507,6 @@ class ASROnlineClientExecutor(BaseExecutor):
|
|
|
|
|
str: the audio text
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Check if the network is reachable
|
|
|
|
|
network = 'http://' + server_ip + ":" + str(port)
|
|
|
|
|
if network_reachable(network) is not True:
|
|
|
|
|
logger.error(f"{network} unreachable, please check the ip address.")
|
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
|
|
logger.info("asr websocket client start")
|
|
|
|
|
handler = ASRWsAudioHandler(
|
|
|
|
|
server_ip,
|
|
|
|
@ -598,12 +572,6 @@ class CLSClientExecutor(BaseExecutor):
|
|
|
|
|
Python API to call an executor.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Check if the network is reachable
|
|
|
|
|
network = 'http://' + server_ip + ":" + str(port)
|
|
|
|
|
if network_reachable(network) is not True:
|
|
|
|
|
logger.error(f"{network} unreachable, please check the ip address.")
|
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
|
|
url = 'http://' + server_ip + ":" + str(port) + '/paddlespeech/cls'
|
|
|
|
|
audio = wav2base64(input)
|
|
|
|
|
data = {"audio": audio, "topk": topk}
|
|
|
|
@ -669,12 +637,6 @@ class TextClientExecutor(BaseExecutor):
|
|
|
|
|
str: the punctuation text
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Check if the network is reachable
|
|
|
|
|
network = 'http://' + server_ip + ":" + str(port)
|
|
|
|
|
if network_reachable(network) is not True:
|
|
|
|
|
logger.error(f"{network} unreachable, please check the ip address.")
|
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
|
|
url = 'http://' + server_ip + ":" + str(port) + '/paddlespeech/text'
|
|
|
|
|
request = {
|
|
|
|
|
"text": input,
|
|
|
|
@ -772,12 +734,6 @@ class VectorClientExecutor(BaseExecutor):
|
|
|
|
|
str: the audio embedding or score between enroll and test audio
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Check if the network is reachable
|
|
|
|
|
network = 'http://' + server_ip + ":" + str(port)
|
|
|
|
|
if network_reachable(network) is not True:
|
|
|
|
|
logger.error(f"{network} unreachable, please check the ip address.")
|
|
|
|
|
sys.exit(-1)
|
|
|
|
|
|
|
|
|
|
if task == "spk":
|
|
|
|
|
from paddlespeech.server.utils.audio_handler import VectorHttpHandler
|
|
|
|
|
logger.info("vector http client start")
|
|
|
|
|