From 1185257000f9b4b5d284c51c91d21957d67013a2 Mon Sep 17 00:00:00 2001 From: Heiko J Schick Date: Wed, 7 Sep 2022 16:02:20 +0200 Subject: [PATCH] Final cleanup of lint output --- tts.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tts.py b/tts.py index 831903b..aa5ee0c 100644 --- a/tts.py +++ b/tts.py @@ -11,10 +11,21 @@ from fairseq.models.text_to_speech.hub_interface import TTSHubInterface import scipy import numpy as np +def read_input_file(name: str): + """ + Read lines from input file + """ + with open(name, "r", encoding="utf-8") as file: + lines = file.readlines() + return lines + def main(): """ Defined starting point of source code. """ + rate = 44100 + full_wave_file = [] + sentences = [] # Parsing command line arguments parser = argparse.ArgumentParser(description='Convert teext to speech.') @@ -30,13 +41,8 @@ def main(): TTSHubInterface.update_cfg_with_data_cfg(cfg, task.data_cfg) generator = task.build_generator(models, cfg) - full_wave_file = [] - rate = 44100 - sentences = [] - # Read input file - with open(args['input'], "r", encoding="utf-8") as file: - lines = file.readlines() + lines = read_input_file(args['input']) # Convert to sentences for line in lines: