Datasets:
metadata
language:
- en
tags:
- art
pretty_name: wikipe-tan
size_categories:
- n<1K
Dataset Process
import json
import os
image_folder = "PATH_TO_IMAGE_FOLDER"
metadata_file = os.path.join(image_folder, 'metadata.jsonl')
with open(metadata_file, 'r', encoding='utf-8') as f:
for line in f:
data = json.loads(line)
filename = data['file_name'].split('.')[0]
text = data['text']
output_file = os.path.join(image_folder, f'{filename}.txt')
with open(output_file, 'w', encoding='utf-8') as txt_file:
txt_file.write(text)
os.remove(metadata_file)