91 lines
1.6 KiB
Markdown
91 lines
1.6 KiB
Markdown
# 包装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流式转换
|
||
|