yuanquderzi / ChatTTS-Deployment-using-FastAPI-and-Streamlit

使用 FastAPI、Streamlit本地部署ChatTTS文本转语音模型,并通过 Docker Compose 进行容器化部署。
19 stars 6 forks source link

一、项目简介

使用 FastAPI 和 Streamlit 本地部署 ChatTTS 文本转语音模型,并通过 Docker Compose 进行容器化部署。

操作流程demo:

语音合成

二、本地安装使用

环境依赖:

cuda12.1   
pip install requirements.txt

程序运行方式:

cd fastapi
uvicorn server:app --host "0.0.0.0" --port 8000
cd streamlit
streamlit run ui.py
curl -X POST -H 'content-type: application/json' -d\
   '{"text":"朋友你好啊,今天天气怎么样 ?", "output_path": "abc.wav", "seed":232}' \
    http://localhost:8000/tts
python client.py

三、Docker 部署

  docker compose build
  docker compose up

这个命令将会:

构建FastAPI和Streamlit服务的Docker镜像。

启动两个服务,将FastAPI暴露在8000端口,Streamlit暴露在8501端口。

要访问生成的服务的 FastAPI 文档,请使用 Web 浏览器访问 http://localhost:8000/docs

要访问UI,请访问 http://localhost:8501

可以通过以下方式检查日志:

  docker compose logs

四、 参考