Datasets:
Commit
·
89c3270
1
Parent(s):
558c805
modified loading script
Browse files
test.py
CHANGED
|
@@ -17,9 +17,9 @@
|
|
| 17 |
import os
|
| 18 |
import csv
|
| 19 |
import json
|
| 20 |
-
import pandas as pd
|
| 21 |
-
|
| 22 |
import datasets
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
_CITATION = """\
|
|
@@ -79,6 +79,7 @@ class Test(datasets.GeneratorBasedBuilder):
|
|
| 79 |
# "unnamed": datasets.Value("int64"),
|
| 80 |
"sentence": datasets.Value("string"),
|
| 81 |
"path": datasets.Value("string"),
|
|
|
|
| 82 |
}
|
| 83 |
)
|
| 84 |
return datasets.DatasetInfo(
|
|
@@ -148,8 +149,10 @@ class Test(datasets.GeneratorBasedBuilder):
|
|
| 148 |
data_df = pd.read_csv(f,sep=',')
|
| 149 |
transcripts = []
|
| 150 |
for index,row in data_df.iterrows():
|
|
|
|
| 151 |
yield key, {
|
| 152 |
"sentence": row["sentence"],
|
| 153 |
"path": row["path"],
|
|
|
|
| 154 |
}
|
| 155 |
key+=1
|
|
|
|
| 17 |
import os
|
| 18 |
import csv
|
| 19 |
import json
|
|
|
|
|
|
|
| 20 |
import datasets
|
| 21 |
+
import pandas as pd
|
| 22 |
+
from scipy.io import wavfile
|
| 23 |
|
| 24 |
|
| 25 |
_CITATION = """\
|
|
|
|
| 79 |
# "unnamed": datasets.Value("int64"),
|
| 80 |
"sentence": datasets.Value("string"),
|
| 81 |
"path": datasets.Value("string"),
|
| 82 |
+
"audio": datasets.Audio(sampling_rate=16_000),
|
| 83 |
}
|
| 84 |
)
|
| 85 |
return datasets.DatasetInfo(
|
|
|
|
| 149 |
data_df = pd.read_csv(f,sep=',')
|
| 150 |
transcripts = []
|
| 151 |
for index,row in data_df.iterrows():
|
| 152 |
+
samplerate, data = wavfile.read(row["path"])
|
| 153 |
yield key, {
|
| 154 |
"sentence": row["sentence"],
|
| 155 |
"path": row["path"],
|
| 156 |
+
"audio":{"path": row["path"], "bytes": data}
|
| 157 |
}
|
| 158 |
key+=1
|