update labels for speakers
Browse files- prepare_model.py +40 -58
- speakers-log.json +21 -21
- speakers.md +0 -21
prepare_model.py
CHANGED
|
@@ -2,47 +2,32 @@ import json
|
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
|
| 5 |
-
def generate_html_output(data, repository_path):
|
| 6 |
-
with open('speakers.md', 'a') as file:
|
| 7 |
-
for speaker_id, speaker_info in data.items():
|
| 8 |
-
out_path = f"{repository_path}/samples/{speaker_id}.wav"
|
| 9 |
-
age = speaker_info['age']
|
| 10 |
-
gender = speaker_info['gender']
|
| 11 |
-
if gender == 'F':
|
| 12 |
-
gender = 'female'
|
| 13 |
-
elif gender == "M":
|
| 14 |
-
gender = 'male'
|
| 15 |
-
accents = speaker_info['accents']
|
| 16 |
-
region = speaker_info['region']
|
| 17 |
-
|
| 18 |
-
file.write(f"<p>VCTK_{speaker_id}: {age} year old {gender}, {accents} accent ({region})<audio controls><source src=\"{out_path}\" type=\"audio/wav\"></audio> </p>\n")
|
| 19 |
-
|
| 20 |
-
|
| 21 |
# Load the data from the provided dictionary
|
| 22 |
data = {
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
-
"
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
-
"
|
| 35 |
-
"
|
| 36 |
-
"
|
| 37 |
-
"
|
| 38 |
-
"
|
| 39 |
-
"
|
| 40 |
-
"
|
| 41 |
-
"
|
| 42 |
-
"
|
| 43 |
-
"
|
| 44 |
}
|
| 45 |
|
|
|
|
| 46 |
# Convert the data to JSON format
|
| 47 |
json_data = json.dumps(data, indent=2)
|
| 48 |
|
|
@@ -61,29 +46,26 @@ speaker_indices = eval(output)
|
|
| 61 |
with open('speakers-log.json', 'r') as file:
|
| 62 |
speaker_ids = json.load(file)
|
| 63 |
|
| 64 |
-
# Create the speakers.md file
|
| 65 |
-
with open('speakers.md', 'w') as file:
|
| 66 |
-
for speaker_idx in speaker_indices:
|
| 67 |
-
# Remove the 'VCTK_' prefix
|
| 68 |
-
speaker_id = speaker_idx.replace('VCTK_', '')
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
continue
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
|
|
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# Load the data from the provided dictionary
|
| 6 |
data = {
|
| 7 |
+
"VCTK_p237": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Fife"},
|
| 8 |
+
"VCTK_p241": {"age": 21, "gender": "M", "accents": "Scottish", "region": "Perth"},
|
| 9 |
+
"VCTK_p245": {"age": 25, "gender": "M", "accents": "Irish", "region": "Dublin"},
|
| 10 |
+
"VCTK_p246": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Selkirk"},
|
| 11 |
+
"VCTK_p247": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Argyll"},
|
| 12 |
+
"VCTK_p252": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Edinburgh"},
|
| 13 |
+
"VCTK_p255": {"age": 19, "gender": "M", "accents": "Scottish", "region": "Galloway"},
|
| 14 |
+
"VCTK_p260": {"age": 21, "gender": "M", "accents": "Scottish", "region": "Orkney"},
|
| 15 |
+
"VCTK_p263": {"age": 22, "gender": "M", "accents": "Scottish", "region": "Aberdeen"},
|
| 16 |
+
"VCTK_p271": {"age": 19, "gender": "M", "accents": "Scottish", "region": "Fife"},
|
| 17 |
+
"VCTK_p272": {"age": 23, "gender": "M", "accents": "Scottish", "region": "Edinburgh"},
|
| 18 |
+
"VCTK_p275": {"age": 23, "gender": "M", "accents": "Scottish", "region": "Midlothian"},
|
| 19 |
+
"VCTK_p281": {"age": 29, "gender": "M", "accents": "Scottish", "region": "Edinburgh"},
|
| 20 |
+
"VCTK_p284": {"age": 20, "gender": "M", "accents": "Scottish", "region": "Fife"},
|
| 21 |
+
"VCTK_p285": {"age": 21, "gender": "M", "accents": "Scottish", "region": "Edinburgh"},
|
| 22 |
+
"VCTK_p292": {"age": 23, "gender": "M", "accents": "NorthernIrish", "region": "Belfast"},
|
| 23 |
+
"VCTK_p298": {"age": 19, "gender": "M", "accents": "Irish", "region": "Tipperary"},
|
| 24 |
+
"VCTK_p304": {"age": 22, "gender": "M", "accents": "NorthernIrish", "region": "Belfast"},
|
| 25 |
+
"VCTK_p326": {"age": 26, "gender": "M", "accents": "Australian English", "region": "Sydney"},
|
| 26 |
+
"VCTK_p364": {"age": 23, "gender": "M", "accents": "Irish", "region": "Donegal"},
|
| 27 |
+
"VCTK_p374": {"age": 28, "gender": "M", "accents": "Australian English", "region": "The Outback"},
|
| 28 |
}
|
| 29 |
|
| 30 |
+
|
| 31 |
# Convert the data to JSON format
|
| 32 |
json_data = json.dumps(data, indent=2)
|
| 33 |
|
|
|
|
| 46 |
with open('speakers-log.json', 'r') as file:
|
| 47 |
speaker_ids = json.load(file)
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
for speaker_idx in speaker_indices:
|
| 51 |
+
# # Remove the 'VCTK_' prefix
|
| 52 |
+
speaker_id = speaker_idx
|
| 53 |
+
# speaker_id = speaker_idx.replace('VCTK_', '')
|
|
|
|
| 54 |
|
| 55 |
+
# Lookup the speaker ID in the loaded speaker IDs
|
| 56 |
+
if speaker_id in speaker_ids:
|
| 57 |
+
speaker_id_json = speaker_ids[speaker_id]
|
| 58 |
+
else:
|
| 59 |
+
continue
|
| 60 |
|
| 61 |
+
# # Generate the TTS command to create the audio file
|
| 62 |
+
# text = f"Hello, I am from {speaker_id_json['region']}. I hope that you will select my voice for your project. Thank you."
|
| 63 |
+
# # make samples directory if it doesn't exist
|
| 64 |
+
# if not os.path.exists("samples"):
|
| 65 |
+
# os.makedirs("samples")
|
| 66 |
|
| 67 |
+
# out_path = f"samples/{speaker_id}.wav"
|
| 68 |
+
# tts_command = f"tts --text \"{text}\" --model_path checkpoint_85000.pth --language_idx en --config_path config.json --speaker_idx \"VCTK_{speaker_id}\" --out_path {out_path}"
|
| 69 |
|
| 70 |
+
# Execute the TTS command
|
| 71 |
+
# os.system(tts_command)
|
speakers-log.json
CHANGED
|
@@ -1,125 +1,125 @@
|
|
| 1 |
{
|
| 2 |
-
"
|
| 3 |
"age": 22,
|
| 4 |
"gender": "M",
|
| 5 |
"accents": "Scottish",
|
| 6 |
"region": "Fife"
|
| 7 |
},
|
| 8 |
-
"
|
| 9 |
"age": 21,
|
| 10 |
"gender": "M",
|
| 11 |
"accents": "Scottish",
|
| 12 |
"region": "Perth"
|
| 13 |
},
|
| 14 |
-
"
|
| 15 |
"age": 25,
|
| 16 |
"gender": "M",
|
| 17 |
"accents": "Irish",
|
| 18 |
"region": "Dublin"
|
| 19 |
},
|
| 20 |
-
"
|
| 21 |
"age": 22,
|
| 22 |
"gender": "M",
|
| 23 |
"accents": "Scottish",
|
| 24 |
"region": "Selkirk"
|
| 25 |
},
|
| 26 |
-
"
|
| 27 |
"age": 22,
|
| 28 |
"gender": "M",
|
| 29 |
"accents": "Scottish",
|
| 30 |
"region": "Argyll"
|
| 31 |
},
|
| 32 |
-
"
|
| 33 |
"age": 22,
|
| 34 |
"gender": "M",
|
| 35 |
"accents": "Scottish",
|
| 36 |
"region": "Edinburgh"
|
| 37 |
},
|
| 38 |
-
"
|
| 39 |
"age": 19,
|
| 40 |
"gender": "M",
|
| 41 |
"accents": "Scottish",
|
| 42 |
"region": "Galloway"
|
| 43 |
},
|
| 44 |
-
"
|
| 45 |
"age": 21,
|
| 46 |
"gender": "M",
|
| 47 |
"accents": "Scottish",
|
| 48 |
"region": "Orkney"
|
| 49 |
},
|
| 50 |
-
"
|
| 51 |
"age": 22,
|
| 52 |
"gender": "M",
|
| 53 |
"accents": "Scottish",
|
| 54 |
"region": "Aberdeen"
|
| 55 |
},
|
| 56 |
-
"
|
| 57 |
"age": 19,
|
| 58 |
"gender": "M",
|
| 59 |
"accents": "Scottish",
|
| 60 |
"region": "Fife"
|
| 61 |
},
|
| 62 |
-
"
|
| 63 |
"age": 23,
|
| 64 |
"gender": "M",
|
| 65 |
"accents": "Scottish",
|
| 66 |
"region": "Edinburgh"
|
| 67 |
},
|
| 68 |
-
"
|
| 69 |
"age": 23,
|
| 70 |
"gender": "M",
|
| 71 |
"accents": "Scottish",
|
| 72 |
"region": "Midlothian"
|
| 73 |
},
|
| 74 |
-
"
|
| 75 |
"age": 29,
|
| 76 |
"gender": "M",
|
| 77 |
"accents": "Scottish",
|
| 78 |
"region": "Edinburgh"
|
| 79 |
},
|
| 80 |
-
"
|
| 81 |
"age": 20,
|
| 82 |
"gender": "M",
|
| 83 |
"accents": "Scottish",
|
| 84 |
"region": "Fife"
|
| 85 |
},
|
| 86 |
-
"
|
| 87 |
"age": 21,
|
| 88 |
"gender": "M",
|
| 89 |
"accents": "Scottish",
|
| 90 |
"region": "Edinburgh"
|
| 91 |
},
|
| 92 |
-
"
|
| 93 |
"age": 23,
|
| 94 |
"gender": "M",
|
| 95 |
"accents": "NorthernIrish",
|
| 96 |
"region": "Belfast"
|
| 97 |
},
|
| 98 |
-
"
|
| 99 |
"age": 19,
|
| 100 |
"gender": "M",
|
| 101 |
"accents": "Irish",
|
| 102 |
"region": "Tipperary"
|
| 103 |
},
|
| 104 |
-
"
|
| 105 |
"age": 22,
|
| 106 |
"gender": "M",
|
| 107 |
"accents": "NorthernIrish",
|
| 108 |
"region": "Belfast"
|
| 109 |
},
|
| 110 |
-
"
|
| 111 |
"age": 26,
|
| 112 |
"gender": "M",
|
| 113 |
"accents": "Australian English",
|
| 114 |
"region": "Sydney"
|
| 115 |
},
|
| 116 |
-
"
|
| 117 |
"age": 23,
|
| 118 |
"gender": "M",
|
| 119 |
"accents": "Irish",
|
| 120 |
"region": "Donegal"
|
| 121 |
},
|
| 122 |
-
"
|
| 123 |
"age": 28,
|
| 124 |
"gender": "M",
|
| 125 |
"accents": "Australian English",
|
|
|
|
| 1 |
{
|
| 2 |
+
"VCTK_p237": {
|
| 3 |
"age": 22,
|
| 4 |
"gender": "M",
|
| 5 |
"accents": "Scottish",
|
| 6 |
"region": "Fife"
|
| 7 |
},
|
| 8 |
+
"VCTK_p241": {
|
| 9 |
"age": 21,
|
| 10 |
"gender": "M",
|
| 11 |
"accents": "Scottish",
|
| 12 |
"region": "Perth"
|
| 13 |
},
|
| 14 |
+
"VCTK_p245": {
|
| 15 |
"age": 25,
|
| 16 |
"gender": "M",
|
| 17 |
"accents": "Irish",
|
| 18 |
"region": "Dublin"
|
| 19 |
},
|
| 20 |
+
"VCTK_p246": {
|
| 21 |
"age": 22,
|
| 22 |
"gender": "M",
|
| 23 |
"accents": "Scottish",
|
| 24 |
"region": "Selkirk"
|
| 25 |
},
|
| 26 |
+
"VCTK_p247": {
|
| 27 |
"age": 22,
|
| 28 |
"gender": "M",
|
| 29 |
"accents": "Scottish",
|
| 30 |
"region": "Argyll"
|
| 31 |
},
|
| 32 |
+
"VCTK_p252": {
|
| 33 |
"age": 22,
|
| 34 |
"gender": "M",
|
| 35 |
"accents": "Scottish",
|
| 36 |
"region": "Edinburgh"
|
| 37 |
},
|
| 38 |
+
"VCTK_p255": {
|
| 39 |
"age": 19,
|
| 40 |
"gender": "M",
|
| 41 |
"accents": "Scottish",
|
| 42 |
"region": "Galloway"
|
| 43 |
},
|
| 44 |
+
"VCTK_p260": {
|
| 45 |
"age": 21,
|
| 46 |
"gender": "M",
|
| 47 |
"accents": "Scottish",
|
| 48 |
"region": "Orkney"
|
| 49 |
},
|
| 50 |
+
"VCTK_p263": {
|
| 51 |
"age": 22,
|
| 52 |
"gender": "M",
|
| 53 |
"accents": "Scottish",
|
| 54 |
"region": "Aberdeen"
|
| 55 |
},
|
| 56 |
+
"VCTK_p271": {
|
| 57 |
"age": 19,
|
| 58 |
"gender": "M",
|
| 59 |
"accents": "Scottish",
|
| 60 |
"region": "Fife"
|
| 61 |
},
|
| 62 |
+
"VCTK_p272": {
|
| 63 |
"age": 23,
|
| 64 |
"gender": "M",
|
| 65 |
"accents": "Scottish",
|
| 66 |
"region": "Edinburgh"
|
| 67 |
},
|
| 68 |
+
"VCTK_p275": {
|
| 69 |
"age": 23,
|
| 70 |
"gender": "M",
|
| 71 |
"accents": "Scottish",
|
| 72 |
"region": "Midlothian"
|
| 73 |
},
|
| 74 |
+
"VCTK_p281": {
|
| 75 |
"age": 29,
|
| 76 |
"gender": "M",
|
| 77 |
"accents": "Scottish",
|
| 78 |
"region": "Edinburgh"
|
| 79 |
},
|
| 80 |
+
"VCTK_p284": {
|
| 81 |
"age": 20,
|
| 82 |
"gender": "M",
|
| 83 |
"accents": "Scottish",
|
| 84 |
"region": "Fife"
|
| 85 |
},
|
| 86 |
+
"VCTK_p285": {
|
| 87 |
"age": 21,
|
| 88 |
"gender": "M",
|
| 89 |
"accents": "Scottish",
|
| 90 |
"region": "Edinburgh"
|
| 91 |
},
|
| 92 |
+
"VCTK_p292": {
|
| 93 |
"age": 23,
|
| 94 |
"gender": "M",
|
| 95 |
"accents": "NorthernIrish",
|
| 96 |
"region": "Belfast"
|
| 97 |
},
|
| 98 |
+
"VCTK_p298": {
|
| 99 |
"age": 19,
|
| 100 |
"gender": "M",
|
| 101 |
"accents": "Irish",
|
| 102 |
"region": "Tipperary"
|
| 103 |
},
|
| 104 |
+
"VCTK_p304": {
|
| 105 |
"age": 22,
|
| 106 |
"gender": "M",
|
| 107 |
"accents": "NorthernIrish",
|
| 108 |
"region": "Belfast"
|
| 109 |
},
|
| 110 |
+
"VCTK_p326": {
|
| 111 |
"age": 26,
|
| 112 |
"gender": "M",
|
| 113 |
"accents": "Australian English",
|
| 114 |
"region": "Sydney"
|
| 115 |
},
|
| 116 |
+
"VCTK_p364": {
|
| 117 |
"age": 23,
|
| 118 |
"gender": "M",
|
| 119 |
"accents": "Irish",
|
| 120 |
"region": "Donegal"
|
| 121 |
},
|
| 122 |
+
"VCTK_p374": {
|
| 123 |
"age": 28,
|
| 124 |
"gender": "M",
|
| 125 |
"accents": "Australian English",
|
speakers.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
<p>VCTK_p237: 22 year old male, Scottish accent (Fife)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p237.wav" type="audio/wav"></audio> </p>
|
| 2 |
-
<p>VCTK_p241: 21 year old male, Scottish accent (Perth)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p241.wav" type="audio/wav"></audio> </p>
|
| 3 |
-
<p>VCTK_p245: 25 year old male, Irish accent (Dublin)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p245.wav" type="audio/wav"></audio> </p>
|
| 4 |
-
<p>VCTK_p246: 22 year old male, Scottish accent (Selkirk)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p246.wav" type="audio/wav"></audio> </p>
|
| 5 |
-
<p>VCTK_p247: 22 year old male, Scottish accent (Argyll)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p247.wav" type="audio/wav"></audio> </p>
|
| 6 |
-
<p>VCTK_p252: 22 year old male, Scottish accent (Edinburgh)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p252.wav" type="audio/wav"></audio> </p>
|
| 7 |
-
<p>VCTK_p255: 19 year old male, Scottish accent (Galloway)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p255.wav" type="audio/wav"></audio> </p>
|
| 8 |
-
<p>VCTK_p260: 21 year old male, Scottish accent (Orkney)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p260.wav" type="audio/wav"></audio> </p>
|
| 9 |
-
<p>VCTK_p263: 22 year old male, Scottish accent (Aberdeen)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p263.wav" type="audio/wav"></audio> </p>
|
| 10 |
-
<p>VCTK_p271: 19 year old male, Scottish accent (Fife)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p271.wav" type="audio/wav"></audio> </p>
|
| 11 |
-
<p>VCTK_p272: 23 year old male, Scottish accent (Edinburgh)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p272.wav" type="audio/wav"></audio> </p>
|
| 12 |
-
<p>VCTK_p275: 23 year old male, Scottish accent (Midlothian)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p275.wav" type="audio/wav"></audio> </p>
|
| 13 |
-
<p>VCTK_p281: 29 year old male, Scottish accent (Edinburgh)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p281.wav" type="audio/wav"></audio> </p>
|
| 14 |
-
<p>VCTK_p284: 20 year old male, Scottish accent (Fife)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p284.wav" type="audio/wav"></audio> </p>
|
| 15 |
-
<p>VCTK_p285: 21 year old male, Scottish accent (Edinburgh)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p285.wav" type="audio/wav"></audio> </p>
|
| 16 |
-
<p>VCTK_p292: 23 year old male, NorthernIrish accent (Belfast)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p292.wav" type="audio/wav"></audio> </p>
|
| 17 |
-
<p>VCTK_p298: 19 year old male, Irish accent (Tipperary)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p298.wav" type="audio/wav"></audio> </p>
|
| 18 |
-
<p>VCTK_p304: 22 year old male, NorthernIrish accent (Belfast)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p304.wav" type="audio/wav"></audio> </p>
|
| 19 |
-
<p>VCTK_p326: 26 year old male, Australian English accent (Sydney)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p326.wav" type="audio/wav"></audio> </p>
|
| 20 |
-
<p>VCTK_p364: 23 year old male, Irish accent (Donegal)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p364.wav" type="audio/wav"></audio> </p>
|
| 21 |
-
<p>VCTK_p374: 28 year old male, Australian English accent (The Outback)<audio controls><source src="https://huggingface.co/voices/VCTK_European_English_Males/resolve/main/samples/p374.wav" type="audio/wav"></audio> </p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|