Update app.py
Browse files
app.py
CHANGED
|
@@ -1146,12 +1146,38 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1146 |
canny_ratio = 0.3 # 30%
|
| 1147 |
|
| 1148 |
# Anpassung für Humanoid → Humanoid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1149 |
if any(keyword in prompt_lower for keyword in humanoid_keywords):
|
| 1150 |
-
|
| 1151 |
-
|
| 1152 |
-
|
| 1153 |
-
|
| 1154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1155 |
|
| 1156 |
# Anpassung für Gegenstand → Gegenstand
|
| 1157 |
elif any(keyword in prompt_lower for keyword in object_keywords):
|
|
|
|
| 1146 |
canny_ratio = 0.3 # 30%
|
| 1147 |
|
| 1148 |
# Anpassung für Humanoid → Humanoid
|
| 1149 |
+
#if any(keyword in prompt_lower for keyword in humanoid_keywords):
|
| 1150 |
+
# adj_strength = 0.5 # wie stark entrauscht wird. Wenn Bereiche transparent oft nicht genug entrauscht. Strukturveränderung ist nicht sehr hoch-niedriger Wert!
|
| 1151 |
+
# controlnet_strength = 0.8 # controlnet_strength runter: Reduziert global und gleichmäßig den Einfluss beider Maps. Man kann auch beide Maps einzeln heruntersetzen. Ist das Gleiche!
|
| 1152 |
+
# pose_ratio = 0.60 # 95%Pose, 5%Canny - wenn Pose gehalten und kaum Detailveränderung-
|
| 1153 |
+
# canny_ratio = 0.10 # wenn Pose gehalten und mehr Detailveränderung -empfohlen 0.85/0.15, canny schlecht für Anime
|
| 1154 |
+
# print("👤 Humanoid → Humanoid → Ratio 85:15 (Pose:Canny)")
|
| 1155 |
+
|
| 1156 |
if any(keyword in prompt_lower for keyword in humanoid_keywords):
|
| 1157 |
+
# Der Parameter 'strength' ist die UI-Stärke
|
| 1158 |
+
ui_strength = strength # Benenne um für Klarheit
|
| 1159 |
+
|
| 1160 |
+
# 1. Basierend auf der UI-Stärke (strength) berechnen
|
| 1161 |
+
adj_strength = ui_strength * 0.7
|
| 1162 |
+
controlnet_strength = 1.0 - (ui_strength * 0.3)
|
| 1163 |
+
pose_ratio = 0.85 - (ui_strength * 0.2)
|
| 1164 |
+
canny_ratio = 0.15 + (ui_strength * 0.2)
|
| 1165 |
+
|
| 1166 |
+
# 2. Werte auf sinnvolle Bereiche begrenzen (Clipping)
|
| 1167 |
+
adj_strength = max(0.3, min(adj_strength, 0.8))
|
| 1168 |
+
controlnet_strength = max(0.4, min(controlnet_strength, 0.95))
|
| 1169 |
+
pose_ratio = max(0.5, min(pose_ratio, 0.9))
|
| 1170 |
+
canny_ratio = max(0.1, min(canny_ratio, 0.5))
|
| 1171 |
+
|
| 1172 |
+
# 3. Finale ControlNet-Stärken berechnen
|
| 1173 |
+
pose_control = controlnet_strength * pose_ratio
|
| 1174 |
+
canny_control = controlnet_strength * canny_ratio
|
| 1175 |
+
|
| 1176 |
+
print(f"👤 Humanoid → Humanoid (UI-Stärke: {ui_strength})")
|
| 1177 |
+
print(f" adj_strength: {adj_strength:.2f}, controlnet: {controlnet_strength:.2f}")
|
| 1178 |
+
print(f" Verhältnis: Pose {pose_ratio*100:.0f}% : Canny {canny_ratio*100:.0f}%")
|
| 1179 |
+
print(f" Finale Scales: Pose {pose_control:.3f}, Canny {canny_control:.3f}")
|
| 1180 |
+
|
| 1181 |
|
| 1182 |
# Anpassung für Gegenstand → Gegenstand
|
| 1183 |
elif any(keyword in prompt_lower for keyword in object_keywords):
|