Added main function as entry point
This commit is contained in:
@@ -10,6 +10,10 @@ import scipy
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import IPython.display as ipd
|
import IPython.display as ipd
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""
|
||||||
|
Defined starting point of source code.
|
||||||
|
"""
|
||||||
|
|
||||||
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
|
models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
|
||||||
"facebook/fastspeech2-en-ljspeech",
|
"facebook/fastspeech2-en-ljspeech",
|
||||||
@@ -37,11 +41,8 @@ for line in lines:
|
|||||||
line = line.replace("(", ". ")
|
line = line.replace("(", ". ")
|
||||||
line = line.replace(")", ". ")
|
line = line.replace(")", ". ")
|
||||||
for x in line.split(". "):
|
for x in line.split(". "):
|
||||||
# print(x)
|
|
||||||
sentences.append(x.strip())
|
sentences.append(x.strip())
|
||||||
# print(sentences)
|
|
||||||
sentences.append("<PAUSE>")
|
sentences.append("<PAUSE>")
|
||||||
# print(sentences)
|
|
||||||
|
|
||||||
# Synthesis text
|
# Synthesis text
|
||||||
for text in sentences:
|
for text in sentences:
|
||||||
@@ -60,3 +61,6 @@ for text in sentences:
|
|||||||
|
|
||||||
full_wave_file = np.array(full_wave_file, dtype=np.float32)
|
full_wave_file = np.array(full_wave_file, dtype=np.float32)
|
||||||
scipy.io.wavfile.write("test.wav", rate, full_wave_file)
|
scipy.io.wavfile.write("test.wav", rate, full_wave_file)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user