posts: automatically tag AI-generated on NovelAI posts.
Automatically add the AI-generated tag to posts that have the `PNG:Software=NovelAI` EXIF attribute. This is not foolproof because this metadata may get removed if an AI-generated post is resaved or uploaded to a site that strips EXIF metadata. It also only works for NovelAI. Currently it detects 29 out of 177 AI-generated uploads on Danbooru.
This commit is contained in:
@@ -24,7 +24,7 @@ class MediaAsset < ApplicationRecord
|
||||
has_many :ai_tags
|
||||
|
||||
delegate :metadata, to: :media_metadata
|
||||
delegate :is_non_repeating_animation?, :is_greyscale?, :is_rotated?, to: :metadata
|
||||
delegate :is_non_repeating_animation?, :is_greyscale?, :is_rotated?, :is_ai_generated?, to: :metadata
|
||||
|
||||
scope :public_only, -> { where(is_public: true) }
|
||||
scope :private_only, -> { where(is_public: false) }
|
||||
|
||||
@@ -465,6 +465,7 @@ class Post < ApplicationRecord
|
||||
tags << "greyscale" if media_asset.is_greyscale?
|
||||
tags << "exif_rotation" if media_asset.is_rotated?
|
||||
tags << "non-repeating_animation" if media_asset.is_non_repeating_animation?
|
||||
tags << "ai-generated" if media_asset.is_ai_generated?
|
||||
|
||||
tags
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user