Skip to content

Commit

Permalink
Add qr controlnet
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherjesse committed Jun 15, 2023
1 parent 953242c commit 995ab32
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"hough": "fusing/stable-diffusion-v1-5-controlnet-mlsd",
"seg": "fusing/stable-diffusion-v1-5-controlnet-seg",
"pose": "fusing/stable-diffusion-v1-5-controlnet-openpose",
'qr': 'DionTimmer/controlnet_qrcode-control_v1p_sd15',
}

SCHEDULERS = {
Expand Down Expand Up @@ -136,6 +137,9 @@ def normal_preprocess(self, img):

def scribble_preprocess(self, img):
return self.hed(img, scribble=True)

def qr_preprocess(self, img):
return img

def seg_preprocessor(self, image):
image = image.convert("RGB")
Expand Down Expand Up @@ -258,6 +262,14 @@ def predict(
description="Conditioning scale for seg controlnet",
default=1,
),
qr_image: Path = Input(
description="Control image for qr controlnet", default=None
),
qr_conditioning_scale: float = Input(
description="Conditioning scale for qr controlnet",
default=1,
),

num_samples: int = Input(
description="Number of samples (higher values may OOM)",
ge=1,
Expand Down Expand Up @@ -322,6 +334,7 @@ def predict(
"pose": [pose_image, pose_conditioning_scale],
"scribble": [scribble_image, scribble_conditioning_scale],
"seg": [seg_image, seg_conditioning_scale],
"qr": [qr_image, qr_conditioning_scale],
},
low_threshold=low_threshold,
high_threshold=high_threshold,
Expand Down
9 changes: 9 additions & 0 deletions samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ def main():
seed=42,
steps=30,
)
gen(
"sample.qr.png",
prompt="A film still of a kraken, reconciliation, 8mm film, traditional color grading, cinemascope, set in 1878",
qr_image="https://github.com/anotherjesse/dream-templates/assets/27/c5df2f7c-7a0c-43ad-93d6-921af0759190",
qr_conditioning_scale=1.5,
seed=42,
scheduler="K_EULER",
steps=50,
)
gen(
"sample.canny.guess.png",
prompt="",
Expand Down

0 comments on commit 995ab32

Please sign in to comment.