knox revisó este gist . Ir a la revisión
1 file changed, 19 insertions
ChatTTS-12.py(archivo creado)
@@ -0,0 +1,19 @@ | |||
1 | + | import ChatTTS | |
2 | + | import torch | |
3 | + | import torchaudio | |
4 | + | ||
5 | + | chat = ChatTTS.Chat() | |
6 | + | chat.load(compile=False) # Set to True for better performance | |
7 | + | ||
8 | + | texts = ["PUT YOUR 1st TEXT HERE", "PUT YOUR 2nd TEXT HERE"] | |
9 | + | ||
10 | + | wavs = chat.infer(texts) | |
11 | + | ||
12 | + | for i in range(len(wavs)): | |
13 | + | """ | |
14 | + | In some versions of torchaudio, the first line works but in other versions, so does the second line. | |
15 | + | """ | |
16 | + | try: | |
17 | + | torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 24000) | |
18 | + | except: | |
19 | + | torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]), 24000) |
Siguiente
Anterior