mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-06-05 13:58:18 +08:00
feat: Added ReturnWay option to get_tts_wav
This commit is contained in:
parent
5c03499fcf
commit
cb2b844f45
@ -838,6 +838,8 @@ def get_tts_wav(
|
|||||||
SaveOutputAsUndecoded=False,
|
SaveOutputAsUndecoded=False,
|
||||||
SaveOutputAsUndecodedName="output.voice",
|
SaveOutputAsUndecodedName="output.voice",
|
||||||
AddRandomSaltToSaveOutputAsUndecodedName=False,
|
AddRandomSaltToSaveOutputAsUndecodedName=False,
|
||||||
|
|
||||||
|
ReturnWay = "yield", # "yield" or "return"
|
||||||
):
|
):
|
||||||
global cache
|
global cache
|
||||||
if ref_wav_path:
|
if ref_wav_path:
|
||||||
@ -1197,10 +1199,15 @@ def get_tts_wav(
|
|||||||
audio_opt /= max_audio
|
audio_opt /= max_audio
|
||||||
else:
|
else:
|
||||||
audio_opt = audio_opt.cpu().detach().numpy()
|
audio_opt = audio_opt.cpu().detach().numpy()
|
||||||
yield opt_sr, (audio_opt * 32767).astype(np.int16)
|
|
||||||
|
if ReturnWay == "yield":
|
||||||
|
yield opt_sr, (audio_opt * 32767).astype(np.int16)
|
||||||
|
else:
|
||||||
|
return opt_sr, (audio_opt * 32767).astype(np.int16)
|
||||||
|
|
||||||
|
|
||||||
def close_serv():
|
def close_serv():
|
||||||
if running_on == "local"
|
if running_on == "local":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
gr.Warning(i18n("服务器环境下该功能不可用"))
|
gr.Warning(i18n("服务器环境下该功能不可用"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user