Skip to content

3choff/FastXttsAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastXttsAPI

This is a fork from XTTS-streaming-server

Added features in the current version:

  1. A new endpoint capable of receiving both streaming and non-streaming requests, using simpler parameters and offering 62 preset studio voices.

  2. A Jupyter Notebook designed to run FastXttsAPI in Google Colab and take advantage of the GPU capabilities of the free tier. Open In Colab

Future Roadmaps

  • Concurrent streaming requests

  • Improved error handling

  • Migration to the actively maintained idiap/coqui-ai-TTS repository, as the original Coqui TTS is discontinued

Video Demo

movie.mp4

Run the server

You can deploy this FastAPI app either in a Docker container (recommended), locally, or in Google Colab Open In Colab.

Using Docker

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)

Local Installation

Unix/Linux

$ git clone https://github.com/3choff/FastXttsAPI.git
$ cd FastXttsAPI/server
$ pip install -r requirements.txt
$ COQUI_TOS_AGREED=1 fastapi run main.py

Windows

> 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

Testing the running server

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.

Using the gradio demo in the video above

$ cd FastXttsAPI
$ python -m pip install -r test/requirements.txt
$ python demo.py

Using the streaming test script

$ cd FastXttsAPI/test
$ python -m pip install -r requirements.txt
$ python test_speech_streaming.py

Clone a Voice with the Test Script

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
  1. 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.
  1. Using the Cloned Voice:
  • To use the cloned voice with the FastAPI server, move the JSON file to the ./server/studio_speakers/ folder.
  1. 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages

  • Python 83.4%
  • Jupyter Notebook 14.2%
  • Dockerfile 2.4%