mirror of https://github.com/coqui-ai/TTS.git
Add Bokeh interactive plotting
This commit is contained in:
parent
b89d04c151
commit
58bf3244ac
|
@ -28,7 +28,7 @@ parser.add_argument(
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'data_path',
|
'data_path',
|
||||||
type=str,
|
type=str,
|
||||||
help='Defines the data path. It overwrites config.json.')
|
help='Data path for wav files - directory or CSV file')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'output_path',
|
'output_path',
|
||||||
type=str,
|
type=str,
|
||||||
|
@ -36,14 +36,42 @@ parser.add_argument(
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--use_cuda', type=bool, help='flag to set cuda.', default=False
|
'--use_cuda', type=bool, help='flag to set cuda.', default=False
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--separator', type=str, help='Separator used in file if CSV is passed for data_path', default='|'
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
c = load_config(args.config_path)
|
c = load_config(args.config_path)
|
||||||
ap = AudioProcessor(**c['audio'])
|
ap = AudioProcessor(**c['audio'])
|
||||||
|
|
||||||
wav_files = glob.glob(args.data_path + '/**/*.wav', recursive=True)
|
data_path = args.data_path
|
||||||
output_files = [wav_file.replace(args.data_path, args.output_path).replace(
|
split_ext = os.path.splitext(data_path)
|
||||||
|
sep = args.separator
|
||||||
|
|
||||||
|
if len(split_ext) > 0 and split_ext[1].lower() == '.csv':
|
||||||
|
# Parse CSV
|
||||||
|
print(f'CSV file: {data_path}')
|
||||||
|
with open(data_path) as f:
|
||||||
|
wav_path = os.path.join(os.path.dirname(data_path), 'wavs')
|
||||||
|
wav_files = []
|
||||||
|
print(f'Separator is: {sep}')
|
||||||
|
for line in f:
|
||||||
|
components = line.split(sep)
|
||||||
|
if len(components) != 2:
|
||||||
|
print("Invalid line")
|
||||||
|
continue
|
||||||
|
wav_file = os.path.join(wav_path, components[0] + '.wav')
|
||||||
|
#print(f'wav_file: {wav_file}')
|
||||||
|
if os.path.exists(wav_file):
|
||||||
|
wav_files.append(wav_file)
|
||||||
|
print(f'Count of wavs imported: {len(wav_files)}')
|
||||||
|
else:
|
||||||
|
# Parse all wav files in data_path
|
||||||
|
wav_path = data_path
|
||||||
|
wav_files = glob.glob(data_path + '/**/*.wav', recursive=True)
|
||||||
|
|
||||||
|
output_files = [wav_file.replace(wav_path, args.output_path).replace(
|
||||||
'.wav', '.npy') for wav_file in wav_files]
|
'.wav', '.npy') for wav_file in wav_files]
|
||||||
|
|
||||||
for output_file in output_files:
|
for output_file in output_files:
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue