Silence MeloTTS stdout in worker
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import contextlib
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
@@ -18,6 +20,15 @@ _MODEL = None
|
||||
_SPEAKER_ID = None
|
||||
|
||||
|
||||
def silence_stdout(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
@silence_stdout
|
||||
def load_model():
|
||||
global _MODEL
|
||||
global _SPEAKER_ID
|
||||
@@ -52,6 +63,7 @@ def handle_ping():
|
||||
}
|
||||
|
||||
|
||||
@silence_stdout
|
||||
def handle_synthesize(params):
|
||||
text = str(params["text"]).strip()
|
||||
output_path = Path(str(params["output_path"]))
|
||||
|
||||
Reference in New Issue
Block a user