This is a fork from XTTS-streaming-server
-
A new endpoint capable of receiving both streaming and non-streaming requests, using simpler parameters and offering 62 preset studio voices.
-
A Jupyter Notebook designed to run FastXttsAPI in Google Colab and take advantage of the GPU capabilities of the free tier.
-
Concurrent streaming requests
-
Improved error handling
-
Migration to the actively maintained idiap/coqui-ai-TTS repository, as the original Coqui TTS is discontinued
movie.mp4
You can deploy this FastAPI app either in a Docker container (recommended), locally, or in Google Colab .
To build the Docker container Pytorch 2.1 and CUDA 11.8 :
DOCKERFILE
may be Dockerfile
, Dockerfile.cpu
, Dockerfile.cuda121
, or your own custom Dockerfile.
$ git clone https://github.com/3choff/FastXttsAPI.git
$ cd FastXttsAPI
$ docker build -t fastxttsapi . -f DOCKERFILE
$ docker run --gpus all -e COQUI_TOS_AGREED=1 --rm -p 8000:80 fastxttsapi
Setting the COQUI_TOS_AGREED
environment variable to 1
indicates you have read and agreed to
the terms of the CPML license. (Fine-tuned XTTS models also are under the CPML license)
$ git clone https://github.com/3choff/FastXttsAPI.git
$ cd FastXttsAPI/server
$ pip install -r requirements.txt
$ COQUI_TOS_AGREED=1 fastapi run main.py
> git clone https://github.com/3choff/FastXttsAPI.git
> cd FastXttsAPI\server
> pip install -r requirements.txt
> set COQUI_TOS_AGREED=1 && fastapi run main.py
Once your server is running, you can test that it's working properly. You will need to run the following code from a fresh terminal.
$ cd FastXttsAPI
$ python -m pip install -r test/requirements.txt
$ python demo.py
$ cd FastXttsAPI/test
$ python -m pip install -r requirements.txt
$ python test_speech_streaming.py
To clone a voice using the test script in FastXttsAPI, follow these steps:
$ cd FastXttsAPI/test
$ python -m pip install -r requirements.txt
$ python test_clone_speaker.py
- Running the Script:
- The script will generate embeddings from the source audio file and save them in a JSON file.
- This JSON file will be stored in the ./test/cloned_speakers/ folder and will be automatically named after the source audio file.
- Using the Cloned Voice:
- To use the cloned voice with the FastAPI server, move the JSON file to the ./server/studio_speakers/ folder.
- Testing the Cloned Voice:
- You can test the cloned voices using either test_speech_streaming.py or test_speech_non_streaming.py.
- Make sure to set the SPEAKER_NAME variable to match the name of the JSON file. For example, if the JSON file is named Samantha.json, set SPEAKER_NAME = "Samantha" after copying the file to the studio_speakers folder.