mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-22 00:03:20 +01:00
Server-side config to allow force-blocking of NSFW images
This commit is contained in:
parent
56bea46e3a
commit
9a9f6e3559
@ -42,9 +42,16 @@ class RenderTask(Task):
|
||||
def run(self):
|
||||
"Runs the image generation task on the assigned thread"
|
||||
|
||||
from easydiffusion import task_manager
|
||||
from easydiffusion import task_manager, app
|
||||
|
||||
context = runtime.context
|
||||
config = app.getConfig()
|
||||
|
||||
if config.get("block_nsfw", False): # override if set on the server
|
||||
self.task_data.block_nsfw = True
|
||||
if "nsfw_checker" not in self.task_data.filters:
|
||||
self.task_data.filters.append("nsfw_checker")
|
||||
self.models_data.model_paths["nsfw_checker"] = "nsfw_checker"
|
||||
|
||||
def step_callback():
|
||||
task_manager.keep_task_alive(self)
|
||||
|
Loading…
Reference in New Issue
Block a user