From fd3ac84d0d400ea806064d50dccd07f8cddb7bdc Mon Sep 17 00:00:00 2001 From: Kaustubh Maske Patil <37668193+nikochiko@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:53:13 +0530 Subject: [PATCH] add safety checker for face inpainting --- recipes/FaceInpainting.py | 5 ++++- recipes/Img2Img.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/FaceInpainting.py b/recipes/FaceInpainting.py index 1e97a3fbe..8770740fb 100644 --- a/recipes/FaceInpainting.py +++ b/recipes/FaceInpainting.py @@ -252,7 +252,10 @@ def render_usage_guide(self): def run(self, state: dict): if not self.request.user.disable_safety_checker: yield "Running safety checker..." - safety_checker(image=state["input_image"]) + safety_checker( + text=state["text_prompt"], + image=state["input_image"], + ) yield "Extracting Face..." diff --git a/recipes/Img2Img.py b/recipes/Img2Img.py index d41deb1f5..65f208a92 100644 --- a/recipes/Img2Img.py +++ b/recipes/Img2Img.py @@ -158,6 +158,7 @@ def run(self, state: dict) -> typing.Iterator[str | None]: yield "Generating Image..." if not self.request.user.disable_safety_checker: + yield "Running safety checker..." safety_checker(text=request.text_prompt, image=request.input_image) if request.selected_model == Img2ImgModels.instruct_pix2pix.name: