mirror of
https://github.com/leon-ai/leon.git
synced 2024-11-30 19:07:39 +03:00
feat(python tcp server): prepare ASR entry point
This commit is contained in:
parent
b25b82b9dc
commit
ed42f9b752
@ -21,3 +21,6 @@ TTS_MODEL_FOLDER_PATH = os.path.join(TTS_LIB_PATH, 'models')
|
||||
TTS_MODEL_CONFIG_PATH = os.path.join(TTS_MODEL_FOLDER_PATH, 'config.json')
|
||||
TTS_MODEL_PATH = os.path.join(TTS_MODEL_FOLDER_PATH, TTS_MODEL_FILE_NAME)
|
||||
IS_TTS_ENABLED = os.environ.get('LEON_TTS', 'true') == 'true'
|
||||
|
||||
# ASR
|
||||
IS_ASR_ENABLED = os.environ.get('LEON_STT', 'true') == 'true'
|
||||
|
@ -7,7 +7,7 @@ import re
|
||||
|
||||
import lib.nlp as nlp
|
||||
from .tts.api import TTS
|
||||
from .constants import TTS_MODEL_CONFIG_PATH, TTS_MODEL_PATH, IS_TTS_ENABLED, TMP_PATH
|
||||
from .constants import TTS_MODEL_CONFIG_PATH, TTS_MODEL_PATH, IS_TTS_ENABLED, TMP_PATH, IS_ASR_ENABLED
|
||||
|
||||
|
||||
class TCPServer:
|
||||
@ -42,6 +42,13 @@ class TCPServer:
|
||||
ckpt_path=TTS_MODEL_PATH
|
||||
)
|
||||
|
||||
def init_asr(self):
|
||||
if not IS_ASR_ENABLED:
|
||||
self.log('ASR is disabled')
|
||||
return
|
||||
|
||||
# TODO
|
||||
|
||||
def init(self):
|
||||
try:
|
||||
# Make sure to establish TCP connection by reusing the address so it does not conflict with port already in use
|
||||
|
@ -15,4 +15,5 @@ tcp_server_port = os.environ.get('LEON_PY_TCP_SERVER_PORT', 1342)
|
||||
|
||||
tcp_server = TCPServer(tcp_server_host, tcp_server_port)
|
||||
tcp_server.init_tts()
|
||||
tcp_server.init_asr()
|
||||
tcp_server.init()
|
||||
|
Loading…
Reference in New Issue
Block a user