From 95dc34f1a244065b26ebcc22ad5d38acafb67a95 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 07:22:49 +0800 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#55) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- webui.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37e47828d..e38256942 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-yaml - id: end-of-file-fixer diff --git a/webui.py b/webui.py index 8f5aba416..d9dbd2ca7 100644 --- a/webui.py +++ b/webui.py @@ -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(