[pre-commit.ci] pre-commit autoupdate (#55)
* [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>
This commit is contained in:
committed by
GitHub
parent
6d89640ef0
commit
95dc34f1a2
@@ -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
|
||||
|
||||
15
webui.py
15
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(
|
||||
|
||||
Reference in New Issue
Block a user