Skip to content

Commit

Permalink
Show info/warning on first activation of nsfw filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Jul 25, 2024
1 parent c7ac5e1 commit 2630ee5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ai_diffusion/language/new_language.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"Model Checkpoint": null,
"Model to encode and decode images. Commonly affects saturation and sharpness.": null,
"NSFW Filter": null,
"NSFW Filter Warning": null,
"Name": null,
"Negative Prompt": null,
"Neutral": null,
Expand Down Expand Up @@ -318,6 +319,7 @@
"The ControlNet model is not installed": null,
"The LoRA '{lora}' used by style '{style}' is not available on the server": null,
"The LoRA file is not installed on the server.": null,
"The NSFW filter is a basic tool to exclude explicit content from generated images. It is NOT a guarantee and may not catch all inappropriate content. Please use responsibly and always review the generated images.": null,
"The Stable Diffusion checkpoint file": null,
"The VAE '{vae}' used by style '{style}' is not available on the server": null,
"The active layer does not contain an animation.": null,
Expand Down
15 changes: 15 additions & 0 deletions ai_diffusion/ui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
QRadioButton,
QComboBox,
QWidget,
QMessageBox,
)
from PyQt5.QtCore import Qt, QMetaObject, QSize, QUrl, pyqtSignal
from PyQt5.QtGui import QDesktopServices, QGuiApplication, QCursor
Expand Down Expand Up @@ -388,9 +389,23 @@ def __init__(self):

nsfw_settings = [("Disabled", 0.0), ("Basic", 0.65), ("Strict", 0.8)]
self._widgets["nsfw_filter"].set_items(nsfw_settings)
DiffusionSettings._warning_shown = self._warning_shown or settings.nsfw_filter > 0

self._layout.addStretch()

_warning_shown = False

def _write(self):
if self._widgets["nsfw_filter"].value > 0 and not self._warning_shown:
DiffusionSettings._warning_shown = True
QMessageBox.warning(
self,
_("NSFW Filter Warning"),
_(
"The NSFW filter is a basic tool to exclude explicit content from generated images. It is NOT a guarantee and may not catch all inappropriate content. Please use responsibly and always review the generated images."
),
)


class InterfaceSettings(SettingsTab):
def __init__(self):
Expand Down

0 comments on commit 2630ee5

Please sign in to comment.