sdwebui-w-horde / sd-webui-stable-horde-worker

Stable Horde Unofficial Worker Bridge as Stable Diffusion WebUI (AUTOMATIC1111) Extension
GNU Affero General Public License v3.0
60 stars 19 forks source link

Check the contents of has_nsfw_concept in addition to the existence. #112

Closed Maeyanie closed 1 year ago

Maeyanie commented 1 year ago

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

MaikoTan commented 1 year ago

good catching!

thanks for the pr.