Spaces:
Running
on
Zero
Running
on
Zero
Tanut
commited on
Commit
·
b593ec0
1
Parent(s):
9c3d0dc
Fix bug
Browse files
app.py
CHANGED
@@ -141,30 +141,30 @@ def qr_stylize(url: str, style_prompt: str, negative: str, steps: int, cfg: floa
|
|
141 |
gc.collect()
|
142 |
|
143 |
with torch.autocast(device_type="cuda", dtype=DTYPE):
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
|
169 |
img = out.images[0]
|
170 |
img = enforce_qr_contrast(img, qr_img, strength=float(repair_strength), feather=float(feather))
|
|
|
141 |
gc.collect()
|
142 |
|
143 |
with torch.autocast(device_type="cuda", dtype=DTYPE):
|
144 |
+
try:
|
145 |
+
# diffusers ≥ 0.30.x uses `image=` for ControlNet’s conditioning input
|
146 |
+
out = pipe(
|
147 |
+
prompt=str(style_prompt),
|
148 |
+
negative_prompt=str(negative or ""),
|
149 |
+
image=qr_img, # <-- use `image`
|
150 |
+
controlnet_conditioning_scale=float(qr_weight),
|
151 |
+
num_inference_steps=int(steps),
|
152 |
+
guidance_scale=float(cfg),
|
153 |
+
width=s, height=s,
|
154 |
+
generator=gen,
|
155 |
+
)
|
156 |
+
except TypeError:
|
157 |
+
# fallback for older versions that still expect `control_image=`
|
158 |
+
out = pipe(
|
159 |
+
prompt=str(style_prompt),
|
160 |
+
negative_prompt=str(negative or ""),
|
161 |
+
control_image=qr_img,
|
162 |
+
controlnet_conditioning_scale=float(qr_weight),
|
163 |
+
num_inference_steps=int(steps),
|
164 |
+
guidance_scale=float(cfg),
|
165 |
+
width=s, height=s,
|
166 |
+
generator=gen,
|
167 |
+
)
|
168 |
|
169 |
img = out.images[0]
|
170 |
img = enforce_qr_contrast(img, qr_img, strength=float(repair_strength), feather=float(feather))
|