Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,12 @@ controlnet_tile = SD3ControlNetModel.from_pretrained("InstantX/SD3-Controlnet-Ti
|
|
20 |
pipe_canny = StableDiffusion3ControlNetPipeline.from_pretrained(
|
21 |
"stabilityai/stable-diffusion-3-medium-diffusers",
|
22 |
controlnet=controlnet_canny
|
23 |
-
)
|
24 |
|
25 |
pipe_tile = StableDiffusion3ControlNetPipeline.from_pretrained(
|
26 |
"stabilityai/stable-diffusion-3-medium-diffusers",
|
27 |
controlnet=controlnet_tile
|
28 |
-
)
|
29 |
|
30 |
def resize_image(input_path, output_path, target_height):
|
31 |
# Open the input image
|
@@ -53,6 +53,7 @@ def infer_canny(image_in, prompt, control_type, inference_steps, guidance_scale,
|
|
53 |
|
54 |
if control_type == "canny":
|
55 |
pipe = pipe_canny
|
|
|
56 |
# Canny preprocessing
|
57 |
image_to_canny = load_image(image_in)
|
58 |
image_to_canny = np.array(image_to_canny)
|
@@ -65,10 +66,9 @@ def infer_canny(image_in, prompt, control_type, inference_steps, guidance_scale,
|
|
65 |
|
66 |
elif control_type == "tile":
|
67 |
pipe = pipe_tile
|
|
|
68 |
control_image = load_image(image_in)
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
# infer
|
73 |
image = pipe(
|
74 |
prompt=prompt,
|
|
|
20 |
pipe_canny = StableDiffusion3ControlNetPipeline.from_pretrained(
|
21 |
"stabilityai/stable-diffusion-3-medium-diffusers",
|
22 |
controlnet=controlnet_canny
|
23 |
+
)
|
24 |
|
25 |
pipe_tile = StableDiffusion3ControlNetPipeline.from_pretrained(
|
26 |
"stabilityai/stable-diffusion-3-medium-diffusers",
|
27 |
controlnet=controlnet_tile
|
28 |
+
)
|
29 |
|
30 |
def resize_image(input_path, output_path, target_height):
|
31 |
# Open the input image
|
|
|
53 |
|
54 |
if control_type == "canny":
|
55 |
pipe = pipe_canny
|
56 |
+
pipe.to("cuda", torch.float16)
|
57 |
# Canny preprocessing
|
58 |
image_to_canny = load_image(image_in)
|
59 |
image_to_canny = np.array(image_to_canny)
|
|
|
66 |
|
67 |
elif control_type == "tile":
|
68 |
pipe = pipe_tile
|
69 |
+
pipe.to("cuda", torch.float16)
|
70 |
control_image = load_image(image_in)
|
71 |
+
|
|
|
|
|
72 |
# infer
|
73 |
image = pipe(
|
74 |
prompt=prompt,
|