Update app.py
Browse files
app.py
CHANGED
|
@@ -1172,15 +1172,28 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1172 |
# 1. Basierend auf der UI-Stärke (strength) berechnen
|
| 1173 |
adj_strength = 0.15 + 0.8 * ui_strength
|
| 1174 |
controlnet_strength = 0.85 - 0.83 * ui_strength
|
| 1175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1176 |
canny_ratio = 1.0 - pose_ratio
|
| 1177 |
|
| 1178 |
|
| 1179 |
# 2. Werte auf sinnvolle Bereiche begrenzen (Clipping)
|
| 1180 |
-
adj_strength = max(0.15, min(adj_strength, 0.
|
| 1181 |
-
controlnet_strength = max(0.
|
| 1182 |
-
pose_ratio = max(0.
|
| 1183 |
-
canny_ratio = max(0.
|
| 1184 |
|
| 1185 |
conditioning_scale = [
|
| 1186 |
controlnet_strength * pose_ratio, # Depth-Gewichtung
|
|
|
|
| 1172 |
# 1. Basierend auf der UI-Stärke (strength) berechnen
|
| 1173 |
adj_strength = 0.15 + 0.8 * ui_strength
|
| 1174 |
controlnet_strength = 0.85 - 0.83 * ui_strength
|
| 1175 |
+
|
| 1176 |
+
|
| 1177 |
+
# 2. DYNAMISCHE POSE-ANPASSUNG: Mehr Pose bei hoher Stärke für Stabilität!
|
| 1178 |
+
# Standard: 0.85 → 0.45 (wie bisher)
|
| 1179 |
+
base_pose_ratio = 0.85 - 0.4 * smoothstep(0.4, 0.8, ui_strength)
|
| 1180 |
+
|
| 1181 |
+
# Pose-Boost bei hoher UI-Stärke (verhindert kleine/verdrehte Körper)
|
| 1182 |
+
if ui_strength > 0.7:
|
| 1183 |
+
pose_boost = (ui_strength - 0.7) * 0.5 # 0 → 0.1 bei UI=0.9
|
| 1184 |
+
pose_ratio = base_pose_ratio + pose_boost
|
| 1185 |
+
else:
|
| 1186 |
+
pose_ratio = base_pose_ratio
|
| 1187 |
+
|
| 1188 |
+
|
| 1189 |
canny_ratio = 1.0 - pose_ratio
|
| 1190 |
|
| 1191 |
|
| 1192 |
# 2. Werte auf sinnvolle Bereiche begrenzen (Clipping)
|
| 1193 |
+
adj_strength = max(0.15, min(adj_strength, 0.92))
|
| 1194 |
+
controlnet_strength = max(0.12, min(controlnet_strength, 0.85))
|
| 1195 |
+
pose_ratio = max(0.45, min(pose_ratio, 0.75))
|
| 1196 |
+
canny_ratio = max(0.25, min(canny_ratio, 0.55))
|
| 1197 |
|
| 1198 |
conditioning_scale = [
|
| 1199 |
controlnet_strength * pose_ratio, # Depth-Gewichtung
|