本文作者:总版主
关注:20
粉丝:502
主题:675
擅长领域:Sora MidJourney Chatgpt Dalle SoVits AI SVC GPT-SoVITS Stablediffusion
显示全部楼层
https://v.douyin.com/ijf2KRYQ/
I. Use the One-Click Installation Package
https://mega.nz/folder/pftDxawT#7oYLykxhDQ-z0EN7V6kLSA
There are 3 versions inside: one is the default version released on the official website, and the other two are extended versions developed by community members. The moderator has already tried them for everyone, so just choose ChatTTS_colab_offline; it is the best to use and has role-playing functionality, while the other two do not. As for the manual installation below, ordinary users certainly do not need to bother, unless you are a developer who needs to develop an application.
II. Manual Installation
1. Download from GitHub
git clone https://github.com/2noise/ChatTTS
2Install Dependencies
Before starting, please make sure the necessary packages are installed. You will need torch and ChatTTS. If they are not installed yet, you can install them with pip:
pip install torch ChatTTS
3. Import the Required Libraries
Import the libraries required by the script. You need torch, ChatTTS, and Audio from IPython.display
import torch
import ChatTTS
from IPython.display import Audio
4. Initialize ChatTTS
Create an instance of the ChatTTS class and load the pre-trained model.
chat = ChatTTS.Chat()
chat.load_models()
5. Prepare Text
Define the text to be converted to speech. Replace <YOUR TEXT HERE> with the text you want.
texts = ["Hello, welcome to ChatTTS!",]
6. Generate Speech
Use the infer method to generate speech from the text. Set use_decoder=True to enable the decoder.
wavs = chat.infer(texts, use_decoder=True)
7. Play Audio
Use the Audio class from IPython.display to play the generated audio. Set the sample rate to 24,000 Hz and enable autoplay.
Audio(wavs[0], rate=24_000, autoplay=True)
8. Complete Script
Below is the complete script for reference:
import torch
import ChatTTS
from IPython.display import Audio
# Initialize ChatTTS
chat = ChatTTS.Chat()
chat.load_models()
# Define the text to be converted to speech
texts = ["Hello, welcome to ChatTTS!",]
# Generate speech
wavs = chat.infer(texts, use_decoder=True)
# Play the generated audio
Audio(wavs[0], rate=24_000, autoplay=True)
|
|