pull/477/head
Eren Gölge 2021-05-03 14:38:42 +02:00
parent 8cb27267a4
commit b10333c238
2 changed files with 15 additions and 6 deletions

View File

@ -1,11 +1,15 @@
dependencies = ['torch', 'gdown', 'pysbd', 'phonemizer', 'unidecode', 'pypinyin'] # apt install espeak-ng
dependencies = [
'torch', 'gdown', 'pysbd', 'phonemizer', 'unidecode', 'pypinyin'
] # apt install espeak-ng
import torch
from TTS.utils.manage import ModelManager
from TTS.utils.synthesizer import Synthesizer
def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA', vocoder_name=None, use_cuda=False):
def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA',
vocoder_name=None,
use_cuda=False):
"""TTS entry point for PyTorch Hub that provides a Synthesizer object to synthesize speech from a give text.
Example:
@ -24,14 +28,19 @@ def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA', vocoder_name=None, us
manager = ModelManager()
model_path, config_path, model_item = manager.download_model(model_name)
vocoder_name = model_item['default_vocoder'] if vocoder_name is None else vocoder_name
vocoder_name = model_item[
'default_vocoder'] if vocoder_name is None else vocoder_name
vocoder_path, vocoder_config_path, _ = manager.download_model(vocoder_name)
# create synthesizer
synt = Synthesizer(model_path, config_path, vocoder_path, vocoder_config_path, use_cuda)
synt = Synthesizer(tts_checkpoint=model_path,
tts_config_path=config_path,
vocoder_checkpoint=vocoder_path,
vocoder_config=vocoder_config_path,
use_cuda=use_cuda)
return synt
if __name__ == '__main__':
synthesizer = torch.hub.load('coqui-ai/TTS:hub_conf', 'tts', source='github')
synthesizer = torch.hub.load('coqui-ai/TTS:dev', 'tts', source='github')
synthesizer.tts("This is a test!")

View File

@ -18,7 +18,7 @@ if LooseVersion(sys.version) < LooseVersion("3.6") or LooseVersion(sys.version)
)
version = '0.0.13.1'
version = '0.0.13.2'
cwd = os.path.dirname(os.path.abspath(__file__))
class build_py(setuptools.command.build_py.build_py): # pylint: disable=too-many-ancestors