File size: 451 Bytes
570c8ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pickle
import os

from .tokenizer_lojban import NixTokenizerEN
from .inference import NixTTSInference

def generate_voice(
    input_text,
    model_dir
):
    tokenizer = NixTokenizerEN(pickle.load(open(os.path.join(model_dir, "tokenizer_state.pkl"), "rb")))
    c, c_length, phoneme = tokenizer([input_text])
    inference = NixTTSInference(model_dir)
    voice = inference.vocalize(c, c_length)

    return [input_text, (22050, voice[0,0])]