Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nsfw image censoring via config and checkbox #958

Merged
merged 16 commits into from
May 18, 2024

Conversation

mashb1t
Copy link
Collaborator

@mashb1t mashb1t commented Nov 15, 2023

activatable via config, uses CompVis/stable-diffusion-safety-checker

closes #950

activatable via config, uses CompVis/stable-diffusion-safety-checker
@mashb1t mashb1t requested a review from lllyasviel as a code owner November 15, 2023 21:02
@mashb1t mashb1t force-pushed the feature/add-nsfw-filter branch from f26d2e7 to 3dc69a5 Compare November 18, 2023 11:17
@mashb1t
Copy link
Collaborator Author

mashb1t commented Dec 16, 2023

now has config path support as mentioned in #1418

makes both enabling via config and checkbox possible, where config overrides the checkbox value
@R080T
Copy link

R080T commented Dec 21, 2023

guys when will be this ready to pull? thanks a lot, appreciate ur job

@mashb1t mashb1t mentioned this pull request Dec 28, 2023
@mashb1t mashb1t changed the title add nsfw image censoring via config add nsfw image censoring via config and checkbox Dec 30, 2023
@mashb1t
Copy link
Collaborator Author

mashb1t commented Dec 30, 2023

guys when will be this ready to pull? thanks a lot, appreciate ur job

@R080T Waiting for the review, probably mid/end of January as mentioned in

**(2023 Dec 21) Hi all, the feature updating of Fooocus will be paused for about two or three weeks because we have some other workloads. See you soon and we will come back in mid or late Jan. However, you may still see updates if other collaborators are fixing bugs or solving problems.**

@R080T
Copy link

R080T commented Dec 30, 2023 via email

@mashb1t mashb1t mentioned this pull request Jan 17, 2024
@ke1ne
Copy link

ke1ne commented Feb 6, 2024

Any plans to merge? Seems to be useful. Thanks

@mashb1t mashb1t added Size L large change, may depend on other changes, thoroughly test package change This PR introduces changes to packages labels Feb 9, 2024
@Msumri
Copy link

Msumri commented Feb 14, 2024

Hey im trying to use the censor but im not sure how to add it to my file i created censor .py and add the lines on the other files but im still able to generate nsfw

@mashb1t
Copy link
Collaborator Author

mashb1t commented Feb 14, 2024

@Msumri please check if you've activated the feature either using the config or the checkbox in the developer debug mode.

@Msumri
Copy link

Msumri commented Feb 14, 2024

config

how do i activate it using config. im sorry im new to all this

Just editing this. I totally overlooked the False value on the config file sorry

@Msumri
Copy link

Msumri commented Feb 14, 2024

i activated it but im still able to generate NSFW

@mashb1t
Copy link
Collaborator Author

mashb1t commented Feb 14, 2024

@Msumri first of all: it's important to note that you can activate this feature by using either config or checkbox.

Second: is the text "Checking for NSFW content" shown as last step of each image generation? If not, ensure you have applied the necessary code adjustments to all 8 affected files.

You can go to https://colab.research.google.com/github/lllyasviel/Fooocus/blob/main/fooocus_colab.ipynb and replace the content of the playbook with the following code to spin up a Colab instance with all changes of this feature branch:

!pip install pygit2==1.12.2
%cd /content
!git clone --branch feature/add-nsfw-filter https://github.com/mashb1t/Fooocus.git
%cd /content/Fooocus
!python entry_with_update.py --share

If this works you've missed some changes (i've already double checked, works fine for me after checking the checkbox "Black Out NSFW").

Screenshot_20240214-203010

@Msumri
Copy link

Msumri commented Feb 15, 2024

@Msumri first of all: it's important to note that you can activate this feature by using either config or checkbox.

Second: is the text "Checking for NSFW content" shown as last step of each image generation? If not, ensure you have applied the necessary code adjustments to all 8 affected files.

You can go to https://colab.research.google.com/github/lllyasviel/Fooocus/blob/main/fooocus_colab.ipynb and replace the content of the playbook with the following code to spin up a Colab instance with all changes of this feature branch:

!pip install pygit2==1.12.2
%cd /content
!git clone --branch feature/add-nsfw-filter https://github.com/mashb1t/Fooocus.git
%cd /content/Fooocus
!python entry_with_update.py --share

If this works you've missed some changes (i've already double checked, works fine for me after checking the checkbox "Black Out NSFW").

Screenshot_20240214-203010

Thanks it worked

@mashb1t mashb1t added this to the 2.3.0 milestone Mar 3, 2024
@mashb1t mashb1t removed this from the 2.3.0 (draft) milestone Mar 15, 2024
@mashb1t mashb1t added this to the 2.4.0 (package updates) milestone Mar 15, 2024
@mashb1t
Copy link
Collaborator Author

mashb1t commented May 17, 2024

fyi I was able to remove the dependency of diffusers by extracting the needed classes into extras.

@mashb1t mashb1t removed the package change This PR introduces changes to packages label May 18, 2024
@mashb1t mashb1t modified the milestones: package updates, 2.4.0 May 18, 2024
@mashb1t mashb1t changed the base branch from main to develop May 18, 2024 13:39
@DisantHoridnt
Copy link

Description:

We have successfully integrated the Fooocus API and are now attempting to incorporate NSFW models into our API built from the repo-- Fooocus-API. We have added the new models by replacing the existing folders in our repository with extras, idm_patched, models, modules, presets, sdxl_styles, wildcards, args_manager.py, and fooocus_version.py. We currently have an issue where the app does not generate any images.

Expected Behavior:
The new NSFW models should load within a reasonable time frame and generate images with the integrated nsfw code.

Actual Behavior:
The models take an excessively long time to load and often do not load at all.

Attachments:
Screen recording

Additional Context:
We are using the following environment setup:

  • OS: Ubuntu 22.04 Ampere A100 (40 GB GPU memory)
  • Python Version: 3.10

@mashb1t
Copy link
Collaborator Author

mashb1t commented May 23, 2024

@PrinceDisant please open an issue / discussion in Fooocus-API repository as this as nothing to do with Fooocus, where the feature has been implemented in develop and is working correctly in 2.4.0-RC1/2 as well as in my fork.

@DisantHoridnt
Copy link

@mashb1t Thank you for the prompt response, I will certainly open an issue there.
I implemented your code for the foocus library into my foocus api, but it didnt work.
I did it as there is no default NSFW for the foocus api.

csokun pushed a commit to csokun/Fooocus that referenced this pull request Jun 16, 2024
* add nsfw image censoring

activatable via config, uses CompVis/stable-diffusion-safety-checker

* fix progressbar call for nsfw output

* use config to set cache dir for safety checker

* add checkbox black_out_nsfw

makes both enabling via config and checkbox possible, where config overrides the checkbox value

* fix: add missing diffusers package

* feat: extract safety checker, remove dependency to diffusers

* feat: make code compatible again after merge with main

* feat: move censor to extras, optimize safety checker file handling

* refactor: rename folder safety_checker_models to safety_checker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size L large change, may depend on other changes, thoroughly test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NSFW filter
5 participants