Update controlnet_module.py
Browse files- controlnet_module.py +15 -15
controlnet_module.py
CHANGED
|
@@ -143,24 +143,24 @@ class ControlNetProcessor:
|
|
| 143 |
raise
|
| 144 |
return self.pipe_canny
|
| 145 |
|
| 146 |
-
|
| 147 |
-
|
| 148 |
steps, guidance_scale, controlnet_strength,
|
| 149 |
progress=None, keep_environment=False
|
| 150 |
):
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
|
| 165 |
pipe = self.load_controlnet_pipeline(controlnet_type)
|
| 166 |
|
|
|
|
| 143 |
raise
|
| 144 |
return self.pipe_canny
|
| 145 |
|
| 146 |
+
|
| 147 |
+
def generate_with_controlnet(self, image, prompt, negative_prompt,
|
| 148 |
steps, guidance_scale, controlnet_strength,
|
| 149 |
progress=None, keep_environment=False
|
| 150 |
):
|
| 151 |
+
try:
|
| 152 |
+
# --- KORREKTE LOGIK ---
|
| 153 |
+
if keep_environment:
|
| 154 |
+
# UMGEBUNG BEIBEHALTEN, PERSON ÄNDERN
|
| 155 |
+
controlnet_type = "canny" # ✅ Canny behält Umgebung
|
| 156 |
+
print("🎯 ControlNet Modus: Umgebung beibehalten (Canny Edge)")
|
| 157 |
+
conditioning_image = self.extract_canny_edges(image)
|
| 158 |
+
else:
|
| 159 |
+
# PERSON BEIBEHALTEN, UMGEBUNG ÄNDERN
|
| 160 |
+
controlnet_type = "openpose" # ✅ OpenPose behält Person
|
| 161 |
+
print("🎯 ControlNet Modus: Person beibehalten (OpenPose)")
|
| 162 |
+
conditioning_image = self.extract_pose(image)
|
| 163 |
+
|
| 164 |
|
| 165 |
pipe = self.load_controlnet_pipeline(controlnet_type)
|
| 166 |
|