This repository provides a Docker image for CosyVoice, enabling you to deploy the CosyVoice ASR service within a Docker container.
To run this Docker container, you’ll need a machine with NVIDIA GPU support and the NVIDIA Container Toolkit installed. For detailed installation steps, please refer to the NVIDIA Container Toolkit guide.
$ docker build -t cosyvoice .
$ docker run -d --name cosyvoice_server -p 8080:8080 \
--runtime=nvidia \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-e NVIDIA_VISIBLE_DEVICES=all \
cosyvoice
- Create a
docker-compose.yml
file:
services:
cosyvoice_server:
image: cosyvoice
container_name: cosyvoice_server
ports:
- "8080:8080"
restart: always
runtime: nvidia
environment:
NVIDIA_DRIVER_CAPABILITIES: all
NVIDIA_VISIBLE_DEVICES: all
- Start the container:
$ docker compose up -d
To test the API, use curl
:
curl -X POST \
"http://127.0.0.1:8080/v1/tts" \
-F "text=你好,欢迎使用语音合成服务" \
-F "spk=中文女" \
--output output.wav