Skip to content

Commit

Permalink
fix: run safety checker before generating QR code
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Aug 29, 2024
1 parent 5bd4834 commit 068501b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions recipes/QRCodeGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ def _render_outputs(self, state: dict, max_count: int | None = None):
def run(self, state: dict) -> typing.Iterator[str | None]:
request: QRCodeGeneratorPage.RequestModel = self.RequestModel.parse_obj(state)

yield "Running safety checker..."
safety_checker(text=request.text_prompt, image=request.image_prompt)

yield "Generating QR Code..."
image, qr_code_data, did_shorten = generate_and_upload_qr_code(
request, self.request.user
Expand All @@ -483,10 +486,6 @@ def run(self, state: dict) -> typing.Iterator[str | None]:

state["raw_images"] = raw_images = []

if request.text_prompt:
yield "Running safety checker..."
safety_checker(text=request.text_prompt)

yield f"Running {Text2ImgModels[request.selected_model].value}..."
if isinstance(request.selected_controlnet_model, str):
request.selected_controlnet_model = [request.selected_controlnet_model]
Expand Down

0 comments on commit 068501b

Please sign in to comment.