NIUBOYI»Home › › Chat TTS › 中文 | English
微信扫一扫 分享朋友圈

已有 1631 人浏览分享

Chat TTS    How to install and deploy Chat TTS on a local computer—here is the detailed tutorial.

2024-6-3 10:15:501631 0
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)
  • WeChat Official Account

  • Scan to Visit Mobile Site

QQ|NIUBOYI ( 京ICP备17025393号 )|网站地图

GMT+8, 2026-10-30 19:45 , Processed in 0.100348 second(s), 41 queries .

POWERED BY NIUBOYIAI! 主理人:NIUBOYIAI  点亮哥

Copyright © 2001-2020, NIUBOYI AI.