TensorFlowTTS / README.md
ruslanmv's picture
Update README.md
9830c09 verified
metadata
tags:
  - TensorFlowTTS
  - audio
  - text-to-speech
  - text-to-mel
language: eng
license: apache-2.0
datasets:
  - LJSpeech
widget:
  - text: How are you?

This repository provides a pretrained FastSpeech trained on LJSpeech dataset (ENG). For a detail of the model, we encourage you to read more about TensorFlowTTS.

Install TensorFlowTTS

First of all, please install TensorFlowTTS with the following command:

pip install TensorFlowTTS

Converting your Text to Mel Spectrogram

import numpy as np
import soundfile as sf
import yaml

import tensorflow as tf

from tensorflow_tts.inference import AutoProcessor
from tensorflow_tts.inference import TFAutoModel

processor = AutoProcessor.from_pretrained("ruslanmv/tensorflowtts")
fastspeech = TFAutoModel.from_pretrained("ruslanmv/tensorflowtts")

text = "How are you?"

input_ids = processor.text_to_sequence(text)

mel_before, mel_after, duration_outputs = fastspeech.inference(
    input_ids=tf.expand_dims(tf.convert_to_tensor(input_ids, dtype=tf.int32), 0),
    speaker_ids=tf.convert_to_tensor([0], dtype=tf.int32),
    speed_ratios=tf.convert_to_tensor([1.0], dtype=tf.float32),
)