Skip to content

Commit

Permalink
fix #467
Browse files Browse the repository at this point in the history
  • Loading branch information
erogol committed May 3, 2021
1 parent 8cb2726 commit b10333c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions hubconf.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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!")
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)


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
Expand Down

0 comments on commit b10333c

Please sign in to comment.