File size: 563 Bytes
29e7e4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import csv
import json

# Télécharge selected_tags.csv depuis https://huggingface.co/SmilingWolf/wd-v1-4-vit-tagger-v2/resolve/main/selected_tags.csv
with open('selected_tags.csv', 'r', encoding='utf-8') as f:
    reader = csv.DictReader(f)
    tags = []
    for row in reader:
        if row['category'] == '0':  # General tags only
            tags.append(row['name'])

with open('tags.json', 'w', encoding='utf-8') as f:
    json.dump(tags, f, ensure_ascii=False)

print(f"General tags only : {len(tags)} tags")
print("Exemples : ", tags[:10])