Update controlnet_module.py
Browse files- controlnet_module.py +3 -14
controlnet_module.py
CHANGED
|
@@ -155,13 +155,11 @@ class ControlNetProcessor:
|
|
| 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 |
-
inpaint_input = image # ✅ ORIGINALBILD für Inpaint!
|
| 159 |
else:
|
| 160 |
# PERSON BEIBEHALTEN, UMGEBUNG ÄNDERN
|
| 161 |
controlnet_type = "openpose" # ✅ OpenPose behält Person
|
| 162 |
print("🎯 ControlNet Modus: Person beibehalten (OpenPose)")
|
| 163 |
conditioning_image = self.extract_pose(image)
|
| 164 |
-
inpaint_input = conditioning_image # ✅ POSE-MAP für Inpaint
|
| 165 |
|
| 166 |
pipe = self.load_controlnet_pipeline(controlnet_type)
|
| 167 |
|
|
@@ -191,26 +189,17 @@ class ControlNetProcessor:
|
|
| 191 |
callback_on_step_end_tensor_inputs=[],
|
| 192 |
)
|
| 193 |
|
| 194 |
-
# Debug-Ausgabe Scheduler Steps
|
| 195 |
-
try:
|
| 196 |
-
scheduler = pipe.scheduler
|
| 197 |
-
if hasattr(scheduler, "timesteps"):
|
| 198 |
-
actual_steps = len(scheduler.timesteps)
|
| 199 |
-
print(f"🎯 CONTROLNET TATSÄCHLICHE STEPS: {actual_steps} (von {steps} angefordert)")
|
| 200 |
-
except Exception as e:
|
| 201 |
-
print(f"⚠️ Konnte ControlNet Scheduler-Info nicht auslesen: {e}")
|
| 202 |
-
|
| 203 |
print("✅ ControlNet abgeschlossen!")
|
| 204 |
|
| 205 |
-
#
|
| 206 |
-
return result.images[0],
|
| 207 |
|
| 208 |
except Exception as e:
|
| 209 |
print(f"❌ Fehler in ControlNet: {e}")
|
| 210 |
import traceback
|
| 211 |
traceback.print_exc()
|
| 212 |
error_image = image.convert("RGB").resize((512, 512))
|
| 213 |
-
return error_image, error_image
|
| 214 |
|
| 215 |
def prepare_inpaint_input(self, image, keep_environment=False):
|
| 216 |
"""
|
|
|
|
| 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 |
pipe = self.load_controlnet_pipeline(controlnet_type)
|
| 165 |
|
|
|
|
| 189 |
callback_on_step_end_tensor_inputs=[],
|
| 190 |
)
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
print("✅ ControlNet abgeschlossen!")
|
| 193 |
|
| 194 |
+
# ZWEI Werte zurückgeben: ControlNet-Output + ORIGINALBILD für Inpaint
|
| 195 |
+
return result.images[0], image # ← IMMER Originalbild für Inpaint!
|
| 196 |
|
| 197 |
except Exception as e:
|
| 198 |
print(f"❌ Fehler in ControlNet: {e}")
|
| 199 |
import traceback
|
| 200 |
traceback.print_exc()
|
| 201 |
error_image = image.convert("RGB").resize((512, 512))
|
| 202 |
+
return error_image, error_image
|
| 203 |
|
| 204 |
def prepare_inpaint_input(self, image, keep_environment=False):
|
| 205 |
"""
|