Skip to content

Commit

Permalink
Adjust-tts-clean-text
Browse files Browse the repository at this point in the history
  • Loading branch information
KamioRinn committed Feb 10, 2024
1 parent 4104171 commit c767450
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions GPT_SoVITS/inference_webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,14 @@ def splite_en_inf(sentence, language):


def clean_text_inf(text, language):
phones, word2ph, norm_text = clean_text(text, language.replace("all_",""))
formattext = ""
language = language.replace("all_","")
for tmp in LangSegment.getTexts(text):
if tmp["lang"] == language:
formattext += tmp["text"] + " "
while " " in formattext:
formattext = formattext.replace(" ", " ")
phones, word2ph, norm_text = clean_text(formattext, language)
phones = cleaned_text_to_sequence(phones)
return phones, word2ph, norm_text

Expand Down Expand Up @@ -305,9 +312,8 @@ def nonen_get_bert_inf(text, language):
print(langlist)
bert_list = []
for i in range(len(textlist)):
text = textlist[i]
lang = langlist[i]
phones, word2ph, norm_text = clean_text_inf(text, lang)
phones, word2ph, norm_text = clean_text_inf(textlist[i], lang)
bert = get_bert_inf(phones, word2ph, norm_text, lang)
bert_list.append(bert)
bert = torch.cat(bert_list, dim=1)
Expand Down

0 comments on commit c767450

Please sign in to comment.