Skip to content

Commit

Permalink
feat: Add safety checker for QR code recipe (#449)
Browse files Browse the repository at this point in the history
* feat: Add safety checker for QR code recipe

* fix: run safety checker before generating QR code
  • Loading branch information
nikochiko authored Aug 29, 2024
1 parent 7860288 commit 9418dc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/QRCodeGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
)
from daras_ai_v2.loom_video_widget import youtube_video
from daras_ai_v2.repositioning import reposition_object, repositioning_preview_widget
from daras_ai_v2.safety_checker import safety_checker
from daras_ai_v2.stable_diffusion import (
Text2ImgModels,
controlnet,
Expand Down Expand Up @@ -472,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 Down

0 comments on commit 9418dc4

Please sign in to comment.