new art categories

This commit is contained in:
rainlizard
2025-03-23 10:17:37 +11:00
parent 9439cf4f37
commit 447528db66
4 changed files with 397 additions and 342 deletions
+53
View File
@@ -0,0 +1,53 @@
def read_tag_mappings(filename):
"""Read file and return dictionary of tag -> category mappings"""
mappings = {}
with open(filename, 'r', encoding='utf-8') as f:
for line in f:
line = line.strip()
if line:
# Split on first occurrence of '] ' to handle tags with spaces
parts = line.split('] ', 1)
if len(parts) == 2:
category = parts[0][1:] # Remove leading '['
tag = parts[1]
mappings[tag] = category
return mappings
def update_categories(source_file, reference_file, output_file):
"""Update categories in source file based on reference file mappings"""
# Read both files
reference_mappings = read_tag_mappings(reference_file)
# Read and process source file
with open(source_file, 'r', encoding='utf-8') as f:
lines = f.readlines()
# Update categories
updated_lines = []
for line in lines:
line = line.strip()
if line:
parts = line.split('] ', 1)
if len(parts) == 2:
tag = parts[1]
if tag in reference_mappings:
# Use new category from reference file
new_category = reference_mappings[tag]
updated_lines.append(f'[{new_category}] {tag}')
else:
# Keep original line if tag not found in reference file
updated_lines.append(line)
else:
updated_lines.append(line)
# Write updated content to output file
with open(output_file, 'w', encoding='utf-8') as f:
f.write('\n'.join(updated_lines))
if __name__ == '__main__':
source_file = 'categorized_tags.txt' # File to update
reference_file = 'new_categories_reference.txt' # File with new categories
output_file = 'new_categories_output.txt' # Output file with updated categories
update_categories(source_file, reference_file, output_file)
print(f'Categories updated and saved to {output_file}')
+340 -340
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -45,7 +45,7 @@ class Raffle:
# Replace all individual category booleans with a single text field for excluded categories
"exclude_categories": ("STRING", {
"multiline": True,
"default": "clothes_and_accessories, female_physical_descriptors, named_garment_exposure, specific_garment_interactions, speech_and_text, standard_physical_descriptors, metadata_and_attribution, intentional_design_exposure, two_handed_character_items, holding_large_items",
"default": "clothes_and_accessories, female_physical_descriptors, named_garment_exposure, specific_garment_interactions, speech_and_text, standard_physical_descriptors, metadata_and_attribution, intentional_design_exposure, two_handed_character_items, holding_large_items, color_scheme",
"tooltip": "Enter category names to exclude, separated by commas. The complete list of available categories can be seen in the 'Debug info' output."
})
},
@@ -179,7 +179,7 @@ class Raffle:
all_categories = [
'abstract_symbols',
'actions',
'artistic_styles_and_publication_formats',
'artstyle_technique',
'background_objects',
'bodily_fluids',
'camera_angle_perspective',
@@ -187,10 +187,12 @@ class Raffle:
'camera_framing_composition',
'character_count',
'clothes_and_accessories',
'color_scheme',
'content_censorship_methods',
'expressions_and_mental_state',
'female_intimate_anatomy',
'female_physical_descriptors',
'format_and_presentation',
'gaze_direction_and_eye_contact',
'general_clothing_exposure',
'generic_clothing_interactions',