f5tts/README.md
2025-02-28 17:45:23 +08:00

91 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 包装F5-TTS为一个服务
## 依赖
分为系统级依赖和python依赖
### 操作系统级别
* 安装FFMpeg
```
sudo apt install ffmpeg
```
* 安装GPU卡驱动
英伟达驱动按照显卡类型到[英伟达网站](https://www.nvidia.com/en-us/drivers/details/241089/)下载后,执行
```
sudo sh 下载的驱动文件
```
### python依赖
* 安装F5-tts相关依赖
```
pip install torch==2.3.0+cu118 torchaudio==2.3.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
```
* 安装F5-TTS
```
pip install git+https://github.com/SWivid/F5-TTS.git
```
* 安装其他依赖
```
pip install git+https://git.kaiyuancloud.cn/yumoqing/apppublic.git
pip install git+https://git.kaiyuancloud.cn/yumoqing/sqlor.git
pip install git+https://git.kaiyuancloud.cn/yumoqing/ahserver.git
pip install cn2an pycld2
```
## 安装与部署
执行下列步骤
* 安装操作系统依赖
* 添加操作系统用户f5tts
* 登录f5tts用户
* 安装python依赖
* 克隆项目
* 运行环境设置
* 启动
* 停止
* 克隆项目
```
cd ~
git clone git@git.kaiyuancloud.cn:yumoqing/f5tts.git
mv f5tts/* ~
rm -rf f5tts
```
* 运行环境设置
```
cd script
bash install.sh
```
* 启动
```
sudo systemctl start f5tts
```
* 停止
```
killname f5tts.py
```
## API
### 添加播音员
url/api/addvoice
方法POST
上传数据
speaker:播音员名称
ref_audio声音文件
ref_text: 录音相应的文字
返回添加成功返回UiMessage的json文件
出错则返回UiError的json文件
### TTS转换
url:/api/inference
方法POST
数据:
prompt:正文文本
speaker播音员名
### TTS流式转换