From 1bdd952457ff6c81ea4a7d628cf911bda21819dc Mon Sep 17 00:00:00 2001 From: zhuang2002 <108931120+zhuang2002@users.noreply.github.com> Date: Fri, 22 Dec 2023 17:19:23 +0800 Subject: [PATCH] [Fix] fix bug of controlnet in powerpaint (#2102) * Update gradio_PowerPaint.py * Update README.md * Update gradio_PowerPaint.py * Update README.md * Update README.md * Update gradio_PowerPaint.py --- projects/powerpaint/README.md | 4 ++++ projects/powerpaint/gradio_PowerPaint.py | 1 + 2 files changed, 5 insertions(+) diff --git a/projects/powerpaint/README.md b/projects/powerpaint/README.md index f78f108bf..bdc6e2082 100644 --- a/projects/powerpaint/README.md +++ b/projects/powerpaint/README.md @@ -12,6 +12,10 @@ This README provides a step-by-step guide to download the repository, set up the - We are delighted to announce the release of more stable model weights. These refined weights can now be accessed on [Hugging Face](https://huggingface.co/JunhaoZhuang/PowerPaint-v1/tree/main). The `gradio_PowerPaint.py` file and [Online Demo](https://openxlab.org.cn/apps/detail/rangoliu/PowerPaint) have also been updated as part of this release. +**December 22, 2023** + +- The logical error in loading ControlNet has been rectified. The `gradio_PowerPaint.py` file and [Online Demo](https://openxlab.org.cn/apps/detail/rangoliu/PowerPaint) have also been updated. + ## Next **Stronger Model Weights Coming Soon!** diff --git a/projects/powerpaint/gradio_PowerPaint.py b/projects/powerpaint/gradio_PowerPaint.py index 2143531ab..37f9ca338 100644 --- a/projects/powerpaint/gradio_PowerPaint.py +++ b/projects/powerpaint/gradio_PowerPaint.py @@ -239,6 +239,7 @@ def predict_controlnet(input_image, input_control_image, control_type, prompt, pipe.tokenizer, pipe.unet, base_control, pipe.scheduler, None, None, False) control_pipe = control_pipe.to('cuda') + current_control = 'canny' if current_control != control_type: if control_type == 'canny' or control_type is None: control_pipe.controlnet = ControlNetModel.from_pretrained(