Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#55)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@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>
  • Loading branch information
pre-commit-ci[bot] authored Oct 9, 2023
1 parent 6d89640 commit 95dc34f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
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 95dc34f

Please sign in to comment.