Astridkraft commited on
Commit
d5fd2d3
·
verified ·
1 Parent(s): 0e38ecb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -1112,17 +1112,28 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1112
  # ===== CONTROLNET-GESTEUERTES INPAINTING DURCHFÜHREN =====
1113
  print(f"🔄 Führe ControlNet-gesteuertes Inpainting durch...")
1114
 
1115
- # Berechne die Gewichtung basierend auf dem Modus
1116
  if keep_environment: # Depth + Canny
 
 
 
 
 
 
 
 
 
1117
  conditioning_scale = [
1118
- controlnet_strength * 0.6, # Depth: 60%
1119
- controlnet_strength * 0.4 # Canny: 40%
1120
  ]
1121
- else: # OpenPose + Canny
 
1122
  conditioning_scale = [
1123
- controlnet_strength * 0.7, # OpenPose: 70%
1124
- controlnet_strength * 0.3 # Canny: 30%
1125
  ]
 
1126
 
1127
  result = pipe(
1128
  prompt=enhanced_prompt,
 
1112
  # ===== CONTROLNET-GESTEUERTES INPAINTING DURCHFÜHREN =====
1113
  print(f"🔄 Führe ControlNet-gesteuertes Inpainting durch...")
1114
 
1115
+ # Berechne die Gewichtung der Maps für Controlnet basierend auf dem Modus
1116
  if keep_environment: # Depth + Canny
1117
+ if mode == "face_only_change":
1118
+ # Für Gesicht: Depth stärker, Canny leichter
1119
+ depth_ratio = 0.7
1120
+ canny_ratio = 0.3
1121
+ else: # environment_change
1122
+ # Für Umgebung: Ausgewogen
1123
+ depth_ratio = 0.6
1124
+ canny_ratio = 0.4
1125
+
1126
  conditioning_scale = [
1127
+ controlnet_strength * depth_ratio,
1128
+ controlnet_strength * canny_ratio
1129
  ]
1130
+
1131
+ else: # OpenPose + Canny (nur focus_change)
1132
  conditioning_scale = [
1133
+ controlnet_strength * pose_ratio,
1134
+ controlnet_strength * canny_ratio
1135
  ]
1136
+
1137
 
1138
  result = pipe(
1139
  prompt=enhanced_prompt,