|
import json |
|
import os |
|
import subprocess |
|
|
|
|
|
data = { |
|
"VCTK_p237": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Fife"}, |
|
"VCTK_p241": {"age": 21, "gender": "M", "accents": "Scottish", "region": "Perth"}, |
|
"VCTK_p245": {"age": 25, "gender": "M", "accents": "Irish", "region": "Dublin"}, |
|
"VCTK_p246": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Selkirk"}, |
|
"VCTK_p247": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Argyll"}, |
|
"VCTK_p252": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Edinburgh"}, |
|
"VCTK_p255": {"age": 19, "gender": "M", "accents": "Scottish", "region": "Galloway"}, |
|
"VCTK_p260": {"age": 21, "gender": "M", "accents": "Scottish", "region": "Orkney"}, |
|
"VCTK_p263": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Aberdeen"}, |
|
"VCTK_p271": {"age": 19, "gender": "M", "accents": "Scottish", "region": "Fife"}, |
|
"VCTK_p272": {"age": 23, "gender": "M", "accents": "Scottish", "region": "Edinburgh"}, |
|
"VCTK_p275": {"age": 23, "gender": "M", "accents": "Scottish", "region": "Midlothian"}, |
|
"VCTK_p281": {"age": 29, "gender": "M", "accents": "Scottish", "region": "Edinburgh"}, |
|
"VCTK_p284": {"age": 20, "gender": "M", "accents": "Scottish", "region": "Fife"}, |
|
"VCTK_p285": {"age": 21, "gender": "M", "accents": "Scottish", "region": "Edinburgh"}, |
|
"VCTK_p292": {"age": 23, "gender": "M", "accents": "NorthernIrish", "region": "Belfast"}, |
|
"VCTK_p298": {"age": 19, "gender": "M", "accents": "Irish", "region": "Tipperary"}, |
|
"VCTK_p304": {"age": 22, "gender": "M", "accents": "NorthernIrish", "region": "Belfast"}, |
|
"VCTK_p326": {"age": 26, "gender": "M", "accents": "Australian English", "region": "Sydney"}, |
|
"VCTK_p364": {"age": 23, "gender": "M", "accents": "Irish", "region": "Donegal"}, |
|
"VCTK_p374": {"age": 28, "gender": "M", "accents": "Australian English", "region": "The Outback"}, |
|
} |
|
|
|
|
|
|
|
json_data = json.dumps(data, indent=2) |
|
|
|
|
|
with open('speakers-log.json', 'w') as file: |
|
file.write(json_data) |
|
|
|
|
|
command = "tts --model_path checkpoint_85000.pth --config_path config.json --list_speaker_idxs | grep -vE '^(\s*\||\s*>|\s*$)'" |
|
output = subprocess.check_output(command, shell=True, text=True) |
|
|
|
|
|
speaker_indices = eval(output) |
|
|
|
|
|
with open('speakers-log.json', 'r') as file: |
|
speaker_ids = json.load(file) |
|
|
|
|
|
for speaker_idx in speaker_indices: |
|
|
|
speaker_id = speaker_idx |
|
|
|
|
|
|
|
if speaker_id in speaker_ids: |
|
speaker_id_json = speaker_ids[speaker_id] |
|
else: |
|
continue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|