Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ class HySpeech(datasets.GeneratorBasedBuilder):
|
|
68 |
with open(n_shards_path) as f:
|
69 |
n_shards = json.load(f)
|
70 |
|
71 |
-
splits = ["
|
72 |
|
73 |
audio_urls = defaultdict(dict)
|
74 |
for split in splits:
|
@@ -92,8 +92,7 @@ class HySpeech(datasets.GeneratorBasedBuilder):
|
|
92 |
name=datasets.Split.TRAIN,
|
93 |
gen_kwargs={
|
94 |
"audio_archives": {
|
95 |
-
'hy': [dl_manager.iter_archive(archive) for archive in
|
96 |
-
for lang_archives in audio_paths["train"].items()
|
97 |
},
|
98 |
"local_extracted_archives_paths": local_extracted_audio_paths["train"],
|
99 |
"metadata_paths": meta_paths["train"],
|
@@ -102,9 +101,9 @@ class HySpeech(datasets.GeneratorBasedBuilder):
|
|
102 |
datasets.SplitGenerator(
|
103 |
name=datasets.Split.VALIDATION,
|
104 |
gen_kwargs={
|
105 |
-
"audio_archives":
|
106 |
-
for
|
107 |
-
,
|
108 |
"local_extracted_archives_paths": local_extracted_audio_paths["dev"],
|
109 |
"metadata_paths": meta_paths["dev"],
|
110 |
}
|
@@ -113,8 +112,7 @@ class HySpeech(datasets.GeneratorBasedBuilder):
|
|
113 |
name=datasets.Split.TEST,
|
114 |
gen_kwargs={
|
115 |
"audio_archives": {
|
116 |
-
'hy': [dl_manager.iter_archive(archive) for archive in
|
117 |
-
for lang_archives in audio_paths["test"].items()
|
118 |
},
|
119 |
"local_extracted_archives_paths": local_extracted_audio_paths["test"],
|
120 |
"metadata_paths": meta_paths["test"],
|
@@ -127,11 +125,13 @@ class HySpeech(datasets.GeneratorBasedBuilder):
|
|
127 |
def _generate_examples(self, audio_archives, local_extracted_archives_paths, metadata_paths):
|
128 |
features = ["raw_text", "normalized_text", "speaker_id", "gender"]
|
129 |
|
130 |
-
meta_path = metadata_paths
|
131 |
with open(meta_path) as f:
|
132 |
-
metadata = {x["
|
|
|
|
|
133 |
|
134 |
-
for audio_archive, local_extracted_archive_path in zip(audio_archives['hy'], local_extracted_archives_paths
|
135 |
for audio_filename, audio_file in audio_archive:
|
136 |
audio_id = audio_filename.split(os.sep)[-1].split(".wav")[0]
|
137 |
path = os.path.join(local_extracted_archive_path, audio_filename) if local_extracted_archive_path else audio_filename
|
|
|
68 |
with open(n_shards_path) as f:
|
69 |
n_shards = json.load(f)
|
70 |
|
71 |
+
splits = ["dev", "test"]
|
72 |
|
73 |
audio_urls = defaultdict(dict)
|
74 |
for split in splits:
|
|
|
92 |
name=datasets.Split.TRAIN,
|
93 |
gen_kwargs={
|
94 |
"audio_archives": {
|
95 |
+
'hy': [dl_manager.iter_archive(archive) for archive in audio_paths["train"]]
|
|
|
96 |
},
|
97 |
"local_extracted_archives_paths": local_extracted_audio_paths["train"],
|
98 |
"metadata_paths": meta_paths["train"],
|
|
|
101 |
datasets.SplitGenerator(
|
102 |
name=datasets.Split.VALIDATION,
|
103 |
gen_kwargs={
|
104 |
+
"audio_archives": {
|
105 |
+
'hy': [dl_manager.iter_archive(archive) for archive in audio_paths["dev"]]
|
106 |
+
},
|
107 |
"local_extracted_archives_paths": local_extracted_audio_paths["dev"],
|
108 |
"metadata_paths": meta_paths["dev"],
|
109 |
}
|
|
|
112 |
name=datasets.Split.TEST,
|
113 |
gen_kwargs={
|
114 |
"audio_archives": {
|
115 |
+
'hy': [dl_manager.iter_archive(archive) for archive in audio_paths["test"]]
|
|
|
116 |
},
|
117 |
"local_extracted_archives_paths": local_extracted_audio_paths["test"],
|
118 |
"metadata_paths": meta_paths["test"],
|
|
|
125 |
def _generate_examples(self, audio_archives, local_extracted_archives_paths, metadata_paths):
|
126 |
features = ["raw_text", "normalized_text", "speaker_id", "gender"]
|
127 |
|
128 |
+
meta_path = metadata_paths
|
129 |
with open(meta_path) as f:
|
130 |
+
metadata = {x["audio_path"].split(os.sep)[-1].split(".wav")[0]: x for x in csv.DictReader(f, delimiter="\t")}
|
131 |
+
|
132 |
+
print(metadata)
|
133 |
|
134 |
+
for audio_archive, local_extracted_archive_path in zip(audio_archives['hy'], local_extracted_archives_paths):
|
135 |
for audio_filename, audio_file in audio_archive:
|
136 |
audio_id = audio_filename.split(os.sep)[-1].split(".wav")[0]
|
137 |
path = os.path.join(local_extracted_archive_path, audio_filename) if local_extracted_archive_path else audio_filename
|