Spaces:
Runtime error
Runtime error
Commit
Β·
dac5cd4
1
Parent(s):
5f04ab8
Added missing control net pipe and removed early launch
Browse files
app.py
CHANGED
@@ -423,6 +423,15 @@ from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
|
|
423 |
from diffusers import UniPCMultistepScheduler
|
424 |
import torch
|
425 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
def controlnet_edges(canny_input_prompt, input_image, input_low_threshold, input_high_threshold, input_invert):
|
427 |
np_image = np.array(input_image)
|
428 |
|
@@ -462,7 +471,7 @@ canny_outputs = gr.outputs.Image(type="pil")
|
|
462 |
|
463 |
# make and launch the gradio app...
|
464 |
controlnet_canny_interface = gr.Interface(fn=controlnet_edges, inputs=[canny_input_prompt, canny_input_image, canny_input_low_threshold, canny_input_high_threshold, canny_input_invert], outputs=canny_outputs, title='Canny Edge Tracing', allow_flagging='never')
|
465 |
-
controlnet_canny_interface.launch()
|
466 |
|
467 |
|
468 |
|
|
|
423 |
from diffusers import UniPCMultistepScheduler
|
424 |
import torch
|
425 |
|
426 |
+
controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
|
427 |
+
controlnet_pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
428 |
+
"runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
|
429 |
+
)
|
430 |
+
|
431 |
+
controlnet_pipe.scheduler = UniPCMultistepScheduler.from_config(controlnet_pipe.scheduler.config)
|
432 |
+
controlnet_pipe.enable_model_cpu_offload()
|
433 |
+
controlnet_pipe.enable_xformers_memory_efficient_attention()
|
434 |
+
|
435 |
def controlnet_edges(canny_input_prompt, input_image, input_low_threshold, input_high_threshold, input_invert):
|
436 |
np_image = np.array(input_image)
|
437 |
|
|
|
471 |
|
472 |
# make and launch the gradio app...
|
473 |
controlnet_canny_interface = gr.Interface(fn=controlnet_edges, inputs=[canny_input_prompt, canny_input_image, canny_input_low_threshold, canny_input_high_threshold, canny_input_invert], outputs=canny_outputs, title='Canny Edge Tracing', allow_flagging='never')
|
474 |
+
# controlnet_canny_interface.launch()
|
475 |
|
476 |
|
477 |
|