It turns out safety_checker() returns an array of booleans rather than a boolean, which was causing the NSFW check to always be true.
In testing, the array was length 1. However, people who know more than me iterate over the array rather than assuming it's always length 1, so I've done the same here.
Fixes #91. However, in testing I did find that even with "Allow NSFW" unchecked in the UI, it will still sometimes get jobs with job.nsfw_censor = False. Because of that the discussion there about using the blacklist and possibly exposing it in the UI is still valid, so I'm not sure if you want to close it or not.
I did a brief investigation into the cause and it seems to be on StableHorde's end; despite "nsfw" being False in the job poll, occasionally it's returning payloads with NSFW jobs anyhow. It shouldn't be too difficult to add a check and reject jobs not matching the current setting, but that's beyond the scope of this PR.
Type of changes
[x] Bugfix
Please check the following items before submitting your pull request
[x] I've checked that this isn't a duplicate pull request.
[x] I've tested my changes with the latest SD-Webui version.
Description
It turns out safety_checker() returns an array of booleans rather than a boolean, which was causing the NSFW check to always be true.
In testing, the array was length 1. However, people who know more than me iterate over the array rather than assuming it's always length 1, so I've done the same here.
Fixes #91. However, in testing I did find that even with "Allow NSFW" unchecked in the UI, it will still sometimes get jobs with job.nsfw_censor = False. Because of that the discussion there about using the blacklist and possibly exposing it in the UI is still valid, so I'm not sure if you want to close it or not.
I did a brief investigation into the cause and it seems to be on StableHorde's end; despite "nsfw" being False in the job poll, occasionally it's returning payloads with NSFW jobs anyhow. It shouldn't be too difficult to add a check and reject jobs not matching the current setting, but that's beyond the scope of this PR.
Type of changes
Please check the following items before submitting your pull request
black .
flake8 .
(The errors there are unrelated to this PR.)