|
import json |
|
import os |
|
import subprocess |
|
|
|
|
|
data = { |
|
"VCTK_p226": {"age": 22, "gender": "M", "accents": "English", "region": "Surrey"}, |
|
"VCTK_p227": {"age": 38, "gender": "M", "accents": "English", "region": "Cumbria"}, |
|
"VCTK_p232": {"age": 23, "gender": "M", "accents": "English", "region": "Southern England"}, |
|
"VCTK_p243": {"age": 22, "gender": "M", "accents": "English", "region": "London"}, |
|
"VCTK_p254": {"age": 21, "gender": "M", "accents": "English", "region": "Surrey"}, |
|
"VCTK_p256": {"age": 24, "gender": "M", "accents": "English", "region": "Birmingham"}, |
|
"VCTK_p258": {"age": 22, "gender": "M", "accents": "English", "region": "Southern England"}, |
|
"VCTK_p259": {"age": 23, "gender": "M", "accents": "English", "region": "Nottingham"}, |
|
"VCTK_p270": {"age": 21, "gender": "M", "accents": "English", "region": "Yorkshire"}, |
|
"VCTK_p273": {"age": 23, "gender": "M", "accents": "English", "region": "Suffolk"}, |
|
"VCTK_p274": {"age": 22, "gender": "M", "accents": "English", "region": "Essex"}, |
|
"VCTK_p278": {"age": 22, "gender": "M", "accents": "English", "region": "Cheshire"}, |
|
"VCTK_p279": {"age": 23, "gender": "M", "accents": "English", "region": "Leicester"}, |
|
"VCTK_p286": {"age": 23, "gender": "M", "accents": "English", "region": "Newcastle"}, |
|
"VCTK_p287": {"age": 23, "gender": "M", "accents": "English", "region": "York"} |
|
} |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|