slight tweaks to condition-less NS/SR

This commit is contained in:
mrq 2025-03-30 10:37:40 -05:00
parent 478aea0e8c
commit 99f251c768
2 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,9 @@ except Exception as e:
print(f'Error while importing langdetect: {str(e)}')
def detect_language( text ):
if not text:
return "en" # to-do: map to a null language
if langdetect is None:
raise Exception('langdetect is not installed.')
return langdetect.detect( text )

View File

@ -385,7 +385,9 @@ class TTS():
text = transcribe( voice_convert, model_name="openai/whisper-base", align=False )["text"]
lines = sentence_split(text, split_by=sampling_kwargs.get("split_text_by", "sentences"))
if not lines:
lines = [""]
wavs = []
sr = None