Astridkraft commited on
Commit
caecf00
·
verified ·
1 Parent(s): 7bbb34d

Update controlnet_module.py

Browse files
Files changed (1) hide show
  1. controlnet_module.py +15 -15
controlnet_module.py CHANGED
@@ -143,24 +143,24 @@ class ControlNetProcessor:
143
  raise
144
  return self.pipe_canny
145
 
146
- def generate_with_controlnet(
147
- self, image, prompt, negative_prompt,
148
  steps, guidance_scale, controlnet_strength,
149
  progress=None, keep_environment=False
150
  ):
151
- """Generiert Bild mit ControlNet und Fortschrittsanzeige"""
152
- try:
153
- # --- ENTSCHEIDUNG: Welches ControlNet für welche Aufgabe? ---
154
- if keep_environment:
155
- # PERSON ÄNDERN, UMGEBUNG BEIBEHALTEN
156
- controlnet_type = "canny"
157
- print("🎯 ControlNet Modus: Umgebung beibehalten (Canny Edge)")
158
- conditioning_image = self.extract_canny_edges(image)
159
- else:
160
- # UMGEBUNG ÄNDERN, PERSON BEIBEHALTEN
161
- controlnet_type = "openpose"
162
- print("🎯 ControlNet Modus: Person beibehalten (OpenPose)")
163
- conditioning_image = self.extract_pose(image)
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