Instructions to use sru17/Text_to_Speech with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Fairseq
How to use sru17/Text_to_Speech with Fairseq:
from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub models, cfg, task = load_model_ensemble_and_task_from_hf_hub( "sru17/Text_to_Speech" ) - Notebooks
- Google Colab
- Kaggle
Delete huggingface.py
Browse files- huggingface.py +0 -39
huggingface.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
# Set up the paths
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
MelGAN_path = 'melgan/'
|
| 5 |
-
TTS_path = 'TransformerTTS/'
|
| 6 |
-
|
| 7 |
-
import sys
|
| 8 |
-
sys.path.append(TTS_path)
|
| 9 |
-
|
| 10 |
-
# Load pretrained model
|
| 11 |
-
from model.factory import tts_ljspeech
|
| 12 |
-
from data.audio import Audio
|
| 13 |
-
|
| 14 |
-
model, config = tts_ljspeech()
|
| 15 |
-
audio = Audio(config)
|
| 16 |
-
|
| 17 |
-
# Synthesize text
|
| 18 |
-
sentence = 'Scientists at the CERN laboratory, say they have discovered a new particle.'
|
| 19 |
-
out_normal = model.predict(sentence)
|
| 20 |
-
|
| 21 |
-
# Convert spectrogram to wav (with griffin lim)
|
| 22 |
-
wav = audio.reconstruct_waveform(out_normal['mel'].numpy().T)
|
| 23 |
-
|
| 24 |
-
import IPython.display as ipd
|
| 25 |
-
|
| 26 |
-
ipd.display(ipd.Audio(wav, rate=config['sampling_rate']))
|
| 27 |
-
|
| 28 |
-
# 20% faster
|
| 29 |
-
sentence = 'Scientists at the CERN laboratory, say they have discovered a new particle.'
|
| 30 |
-
out = model.predict(sentence, speed_regulator=1.20)
|
| 31 |
-
wav = audio.reconstruct_waveform(out['mel'].numpy().T)
|
| 32 |
-
ipd.display(ipd.Audio(wav, rate=config['sampling_rate']))
|
| 33 |
-
|
| 34 |
-
# 10% slower
|
| 35 |
-
sentence = 'Scientists at the CERN laboratory, say they have discovered a new particle.'
|
| 36 |
-
out = model.predict(sentence, speed_regulator=.9)
|
| 37 |
-
wav = audio.reconstruct_waveform(out['mel'].numpy().T)
|
| 38 |
-
ipd.display(ipd.Audio(wav, rate=config['sampling_rate']))
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|