Fix: pyopenjtalk_worker not working
This commit is contained in:
@@ -56,7 +56,6 @@ def initialize(port: int = WORKER_PORT) -> None:
|
||||
import sys
|
||||
import time
|
||||
|
||||
logger.debug("initialize")
|
||||
global WORKER_CLIENT
|
||||
if WORKER_CLIENT:
|
||||
return
|
||||
@@ -98,6 +97,7 @@ def initialize(port: int = WORKER_PORT) -> None:
|
||||
if count == 20:
|
||||
raise TimeoutError("サーバーに接続できませんでした")
|
||||
|
||||
logger.debug("pyopenjtalk worker server started")
|
||||
WORKER_CLIENT = client
|
||||
atexit.register(terminate)
|
||||
|
||||
@@ -110,7 +110,7 @@ def initialize(port: int = WORKER_PORT) -> None:
|
||||
|
||||
# top-level declaration
|
||||
def terminate() -> None:
|
||||
logger.debug("terminate")
|
||||
logger.debug("pyopenjtalk worker server terminated")
|
||||
global WORKER_CLIENT
|
||||
if not WORKER_CLIENT:
|
||||
return
|
||||
|
||||
@@ -16,7 +16,7 @@ from style_bert_vits2.nlp.japanese.pyopenjtalk_worker.worker_common import (
|
||||
|
||||
# To make it as fast as possible
|
||||
# Probably faster than calling getattr every time
|
||||
__PYOPENJTALK_FUNC_DICT = {
|
||||
PYOPENJTALK_FUNC_DICT = {
|
||||
"run_frontend": pyopenjtalk.run_frontend,
|
||||
"make_label": pyopenjtalk.make_label,
|
||||
"mecab_dict_index": pyopenjtalk.mecab_dict_index,
|
||||
@@ -57,7 +57,7 @@ class WorkerServer:
|
||||
elif request_type == RequestType.PYOPENJTALK:
|
||||
func_name = request.get("func")
|
||||
assert isinstance(func_name, str)
|
||||
func = __PYOPENJTALK_FUNC_DICT[func_name]
|
||||
func = PYOPENJTALK_FUNC_DICT[func_name]
|
||||
args = request.get("args")
|
||||
kwargs = request.get("kwargs")
|
||||
assert isinstance(args, list)
|
||||
|
||||
Reference in New Issue
Block a user