Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 7, 2023
1 parent 6e24916 commit 138c633
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion emo_gen.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

15 changes: 13 additions & 2 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,29 @@ def infer(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, sid, langua
return audio


def tts_fn(text, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale, language):
def tts_fn(
text, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale, language
):
slices = text.split("|")
audio_list = []
with torch.no_grad():
for slice in slices:
audio = infer(slice, sdp_ratio=sdp_ratio, noise_scale=noise_scale, noise_scale_w=noise_scale_w, length_scale=length_scale, sid=speaker, language=language)
audio = infer(
slice,
sdp_ratio=sdp_ratio,
noise_scale=noise_scale,
noise_scale_w=noise_scale_w,
length_scale=length_scale,
sid=speaker,
language=language,
)
audio_list.append(audio)
silence = np.zeros(hps.data.sampling_rate) # 生成1秒的静音
audio_list.append(silence) # 将静音添加到列表中
audio_concat = np.concatenate(audio_list)
return "Success", (hps.data.sampling_rate, audio_concat)


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down

0 comments on commit 138c633

Please sign in to comment.