Spaces:
Runtime error
Runtime error
added separate pipe without ControlNet
Browse files
app.py
CHANGED
|
@@ -25,8 +25,8 @@ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype
|
|
| 25 |
# Scheduler
|
| 26 |
eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", subfolder="scheduler")
|
| 27 |
|
| 28 |
-
# Stable Diffusion Model
|
| 29 |
-
|
| 30 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 31 |
controlnet=controlnet,
|
| 32 |
vae=vae,
|
|
@@ -34,6 +34,14 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
|
| 34 |
scheduler=eulera_scheduler,
|
| 35 |
)
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
pipe.to(device)
|
| 38 |
|
| 39 |
|
|
@@ -55,7 +63,7 @@ def generate_image(prompt, input_image, low_threshold, high_threshold, strength,
|
|
| 55 |
edge_detected = apply_canny(input_image, low_threshold, high_threshold)
|
| 56 |
|
| 57 |
# Generate styled image using ControlNet
|
| 58 |
-
result =
|
| 59 |
prompt=prompt,
|
| 60 |
image=edge_detected,
|
| 61 |
num_inference_steps=30,
|
|
|
|
| 25 |
# Scheduler
|
| 26 |
eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", subfolder="scheduler")
|
| 27 |
|
| 28 |
+
# Stable Diffusion Model with ControlNet
|
| 29 |
+
pipe_cn = StableDiffusionXLControlNetPipeline.from_pretrained(
|
| 30 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 31 |
controlnet=controlnet,
|
| 32 |
vae=vae,
|
|
|
|
| 34 |
scheduler=eulera_scheduler,
|
| 35 |
)
|
| 36 |
|
| 37 |
+
# Stable Diffusion Model without ControlNet
|
| 38 |
+
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
| 39 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 40 |
+
vae=vae,
|
| 41 |
+
torch_dtype=precision,
|
| 42 |
+
scheduler=eulera_scheduler,
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
pipe.to(device)
|
| 46 |
|
| 47 |
|
|
|
|
| 63 |
edge_detected = apply_canny(input_image, low_threshold, high_threshold)
|
| 64 |
|
| 65 |
# Generate styled image using ControlNet
|
| 66 |
+
result = pipe_cn(
|
| 67 |
prompt=prompt,
|
| 68 |
image=edge_detected,
|
| 69 |
num_inference_steps=30,
|