Spaces:
Runtime error
Runtime error
File size: 632 Bytes
04ea122 0e9b704 04ea122 c7380eb 04ea122 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub
from fairseq.models.text_to_speech.hub_interface import TTSHubInterface
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
"facebook/fastspeech2-en-ljspeech",
arg_overrides={"vocoder": "hifigan", "fp16": False}
)
model = models
TTSHubInterface.update_cfg_with_data_cfg(cfg, task.data_cfg)
generator = task.build_generator(model, cfg)
def tts(text):
print("Converting to TTS")
sample = TTSHubInterface.get_model_input(task, text)
wav, rate = TTSHubInterface.get_prediction(task, model, generator, sample)
return wave, rate |