File size: 1,059 Bytes
1593567 a5dfbc8 1593567 a5dfbc8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# dataset.py
from datasets import DatasetBuilder, DatasetInfo, SplitGenerator, Features, Value, Audio
import os
import pandas as pd
class MarathiTTSDataset(DatasetBuilder):
def _info(self):
return DatasetInfo(
description="Marathi Text-to-Speech dataset.",
features=Features({
'audio': Audio(sampling_rate=22050), # Adjust if your audio has a different sampling rate
'text': Value('string'),
}),
supervised_keys=None,
)
def _split_generators(self, dl_manager):
data_dir = os.path.abspath(".")
return [
SplitGenerator(
name="train",
gen_kwargs={
"filepath": os.path.join(data_dir, "train.csv"),
},
)
]
def _generate_examples(self, filepath):
df = pd.read_csv(filepath)
for idx, row in df.iterrows():
yield idx, {
'audio': row['audio'],
'text': row['text'],
}
|