forked from mrq/tortoise-tts
sloppily guarantee stop/reloading TTS actually works
This commit is contained in:
parent
4b3b0ead1a
commit
50073e635f
17
webui.py
17
webui.py
|
@ -436,8 +436,9 @@ def check_for_updates():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def reload_tts():
|
def reload_tts():
|
||||||
|
global tts
|
||||||
del tts
|
del tts
|
||||||
tts = setup_tortoise()
|
tts = setup_tortoise(restart=True)
|
||||||
|
|
||||||
def cancel_generate():
|
def cancel_generate():
|
||||||
tortoise.api.STOP_SIGNAL = True
|
tortoise.api.STOP_SIGNAL = True
|
||||||
|
@ -535,11 +536,12 @@ def setup_args():
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def setup_tortoise():
|
def setup_tortoise(restart=False):
|
||||||
global args
|
global args
|
||||||
|
global tts
|
||||||
global voicefixer
|
global voicefixer
|
||||||
|
|
||||||
if args.voice_fixer:
|
if args.voice_fixer and not restart:
|
||||||
try:
|
try:
|
||||||
from voicefixer import VoiceFixer
|
from voicefixer import VoiceFixer
|
||||||
print("Initializating voice-fixer")
|
print("Initializating voice-fixer")
|
||||||
|
@ -555,6 +557,7 @@ def setup_tortoise():
|
||||||
|
|
||||||
def setup_gradio():
|
def setup_gradio():
|
||||||
global args
|
global args
|
||||||
|
|
||||||
if not args.share:
|
if not args.share:
|
||||||
def noop(function, return_value=None):
|
def noop(function, return_value=None):
|
||||||
def wrapped(*args, **kwargs):
|
def wrapped(*args, **kwargs):
|
||||||
|
@ -863,13 +866,17 @@ def setup_gradio():
|
||||||
progress
|
progress
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise gr.Error(e)
|
message = str(e)
|
||||||
|
if message == "Kill signal detected":
|
||||||
|
reload_tts()
|
||||||
|
|
||||||
|
raise gr.Error(message)
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
outputs[0],
|
outputs[0],
|
||||||
gr.update(value=sample, visible=sample is not None),
|
gr.update(value=sample, visible=sample is not None),
|
||||||
gr.update(choices=outputs, visible=len(outputs) > 1, interactive=True),
|
gr.update(choices=outputs, value=outputs[0], visible=len(outputs) > 1, interactive=True),
|
||||||
gr.update(visible=len(outputs) > 1),
|
gr.update(visible=len(outputs) > 1),
|
||||||
gr.update(value=stats, visible=True),
|
gr.update(value=stats, visible=True),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user