Added main function as entry point

This commit is contained in:
Heiko J Schick
2022-08-30 16:28:44 +02:00
parent 5978cb7bcf
commit 494b15fd91
+7 -3
View File
@@ -10,6 +10,10 @@ import scipy
import numpy as np
import IPython.display as ipd
def main():
"""
Defined starting point of source code.
"""
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
"facebook/fastspeech2-en-ljspeech",
@@ -37,11 +41,8 @@ for line in lines:
line = line.replace("(", ". ")
line = line.replace(")", ". ")
for x in line.split(". "):
# print(x)
sentences.append(x.strip())
# print(sentences)
sentences.append("<PAUSE>")
# print(sentences)
# Synthesis text
for text in sentences:
@@ -60,3 +61,6 @@ for text in sentences:
full_wave_file = np.array(full_wave_file, dtype=np.float32)
scipy.io.wavfile.write("test.wav", rate, full_wave_file)
if __name__ == "__main__":
main()