minimalist-desktop-wallpaper / sd-scripts /convert_to_metadata_of_kohya.py
mrtuandao's picture
Upload folder using huggingface_hub
aa03424 verified
raw
history blame contribute delete
278 Bytes
import json
import os
from pathlib import Path
image_paths = os.listdir('../images')
metadata = {}
for image_path in image_paths:
caption = Path(image_path).stem
metadata[image_path] = caption
with open('metadata.json', 'w') as f:
json.dump(metadata, f, indent=4)