Datasets:
File size: 720 Bytes
cd53130 |
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 |
"""Create a JSON file mapping of available audio files to the TTS models that generated them.
The output JSON has the following structure:
{
"path1.mp3": [
"model1",
"model2",
...
],
"path2.mp3": [
"model1",
...
],
...
}
"""
from collections import defaultdict
import json
import os
import pandas as pd
df = pd.read_csv("metadata-balanced.csv")
models = ["commonvoice", "metavoice", "playht", "stylettsv2", "xttsv2"]
ds = defaultdict(list)
for path in df.path:
for model in models:
if os.path.exists(os.path.join(model, path)):
ds[path].append(model)
with open("files.json", "w") as json_file:
json.dump(ds, json_file, indent=4)
|