Update app.py
Browse files
app.py
CHANGED
|
@@ -1184,24 +1184,34 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1184 |
|
| 1185 |
# 2. DYNAMISCHE POSE-ANPASSUNG: Mehr Pose bei hoher Stärke für Stabilität!
|
| 1186 |
# Standard: 0.85 → 0.45 (wie bisher)
|
| 1187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1188 |
|
| 1189 |
# Pose-Boost bei hoher UI-Stärke (verhindert kleine/verdrehte Körper)
|
| 1190 |
-
if ui_strength > 0.7:
|
| 1191 |
-
|
| 1192 |
-
|
| 1193 |
-
else:
|
| 1194 |
-
|
| 1195 |
|
| 1196 |
|
| 1197 |
canny_ratio = 1.0 - pose_ratio
|
| 1198 |
|
| 1199 |
|
| 1200 |
# 2. Werte auf sinnvolle Bereiche begrenzen (Clipping)
|
| 1201 |
-
adj_strength = max(0.15, min(adj_strength, 0.
|
| 1202 |
controlnet_strength = max(0.12, min(controlnet_strength, 0.85))
|
| 1203 |
-
pose_ratio = max(0.45, min(pose_ratio, 0.
|
| 1204 |
-
canny_ratio = max(0.
|
| 1205 |
|
| 1206 |
conditioning_scale = [
|
| 1207 |
controlnet_strength * pose_ratio, # Depth-Gewichtung
|
|
|
|
| 1184 |
|
| 1185 |
# 2. DYNAMISCHE POSE-ANPASSUNG: Mehr Pose bei hoher Stärke für Stabilität!
|
| 1186 |
# Standard: 0.85 → 0.45 (wie bisher)
|
| 1187 |
+
base_pose = 0.85 - 0.4 * smoothstep(0.4, 0.8, ui_strength)
|
| 1188 |
+
|
| 1189 |
+
|
| 1190 |
+
# Canny-Reduktion bei hoher Stärke für Farbfreiheit
|
| 1191 |
+
if ui_strength > 0.6:
|
| 1192 |
+
# Je höher die Stärke, desto weniger Canny (für Farbänderungen)
|
| 1193 |
+
canny_reduction = smoothstep(0.6, 0.9, ui_strength) * 0.3
|
| 1194 |
+
pose_ratio = min(0.75, base_pose + canny_reduction) # Pose erhöhen = Canny reduzieren
|
| 1195 |
+
else:
|
| 1196 |
+
pose_ratio = base_pose
|
| 1197 |
+
|
| 1198 |
|
| 1199 |
# Pose-Boost bei hoher UI-Stärke (verhindert kleine/verdrehte Körper)
|
| 1200 |
+
#if ui_strength > 0.7:
|
| 1201 |
+
# pose_boost = (ui_strength - 0.7) * 0.5 # 0 → 0.1 bei UI=0.9
|
| 1202 |
+
# pose_ratio = base_pose_ratio + pose_boost
|
| 1203 |
+
#else:
|
| 1204 |
+
# pose_ratio = base_pose_ratio
|
| 1205 |
|
| 1206 |
|
| 1207 |
canny_ratio = 1.0 - pose_ratio
|
| 1208 |
|
| 1209 |
|
| 1210 |
# 2. Werte auf sinnvolle Bereiche begrenzen (Clipping)
|
| 1211 |
+
adj_strength = max(0.15, min(adj_strength, 0.95))
|
| 1212 |
controlnet_strength = max(0.12, min(controlnet_strength, 0.85))
|
| 1213 |
+
pose_ratio = max(0.45, min(pose_ratio, 0.80))
|
| 1214 |
+
canny_ratio = max(0.20, min(canny_ratio, 0.55))
|
| 1215 |
|
| 1216 |
conditioning_scale = [
|
| 1217 |
controlnet_strength * pose_ratio, # Depth-Gewichtung
|