A script for automatically hiding the screen in OBS when NSFW content is detected on the user's screen.
-
Install Python
- Download and install Python.
-
Clone or download the repository:
git clone https://github.com/Serfetto/NSFW-Classification
-
Install dependencies
pip install -r path\to\requirements.txt
-
Select the launch method
- On a graphics card (GPU): Make sure that you have PyTorch installed with CUDA support. Follow the PyTorch instructions to install the desired version.
- On the processor (CPU): No additional settings are required.
- Add the video source to OBS
- Note: the script takes a screenshot of the entire screen, and does not use direct interaction with OBS.
- Configure Python in OBS
- Open OBS, go to the Tools → Scripts tab.
- In the scripts window, go to the Python Settings tab and specify the path to python.exe . It is usually located along the path:
C:\Users \<name>\AppData\Local\Programs\Python\Python<version> - After successfully adding Python, you will see a message about the Python version (for example, "Python version 3.10 has been downloaded").
- Add the script
- In the Scripts tab, click on the
+icon and select the fileScriptWithUI.py.
- In the Scripts tab, click on the
- Model and scene settings
- After adding the script, you will be prompted to specify the path to the model and the scene where the filter will be created to hide the screen (the source
Background coloris added).
- After adding the script, you will be prompted to specify the path to the model and the scene where the filter will be created to hide the screen (the source
- Download the model
- The model is available for download at this link.
- Specify the path to the model
- Example of a path:
C:\Users \<name>\Downloads\512old.pt
- Example of a path:
- Start filtering
- Click the
Start filteringbutton so that the script creates a "Background Color (filter nsfw)" source. After clicking on theStop filteringbutton, the script will automatically delete the created source and finish its work - The script will launch a model that will hide the screen when NSFW content is detected. Depending on your settings, the startup can take place on the GPU or CPU (see the section "Installation", point 4).
- Click the
Upd: This script doesn't work on operating system Linux
P.S. For more information about training model, you can find in this repositoty