Update app.py
Browse files
app.py
CHANGED
|
@@ -1419,6 +1419,40 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1419 |
drawing_keywords = ["drawing", "illustration", "sketch", "painting", "artwork", "watercolor"]
|
| 1420 |
|
| 1421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1422 |
if any(keyword in prompt_lower for keyword in anime_keywords):
|
| 1423 |
# Anime: Mehr Denoising für Stiländerungen
|
| 1424 |
adj_strength = 0.55 + (ui_strength * 0.3) # 0.2-1.0
|
|
|
|
| 1419 |
drawing_keywords = ["drawing", "illustration", "sketch", "painting", "artwork", "watercolor"]
|
| 1420 |
|
| 1421 |
|
| 1422 |
+
|
| 1423 |
+
if any(keyword in prompt_lower for keyword in anime_keywords):
|
| 1424 |
+
print("🎨 ANIME-TRANSFORM-MODUS")
|
| 1425 |
+
|
| 1426 |
+
def smoothstep(min_val, max_val, x):
|
| 1427 |
+
x = max(0, min(1, (x - min_val) / (max_val - min_val)))
|
| 1428 |
+
return x * x * (3 - 2 * x)
|
| 1429 |
+
|
| 1430 |
+
# 1️⃣ Transformationsdruck (radikal erst spät)
|
| 1431 |
+
adj_strength = 0.30 + 0.55 * smoothstep(0.35, 0.9, ui_strength)
|
| 1432 |
+
adj_strength = max(0.3, min(adj_strength, 0.85))
|
| 1433 |
+
|
| 1434 |
+
# 2️⃣ ControlNet: lange frei, dann stabilisieren
|
| 1435 |
+
controlnet_strength = 0.30 + 0.52 * smoothstep(0.65, 0.9, ui_strength)
|
| 1436 |
+
controlnet_strength = max(0.25, min(controlnet_strength, 0.85))
|
| 1437 |
+
|
| 1438 |
+
# 3️⃣ Anime-Ratios (normiert!)
|
| 1439 |
+
depth_ratio = 0.55 + 0.15 * smoothstep(0.5, 0.9, ui_strength)
|
| 1440 |
+
canny_ratio = 1.0 - depth_ratio
|
| 1441 |
+
|
| 1442 |
+
# 4️⃣ Conditioning
|
| 1443 |
+
conditioning_scale = [
|
| 1444 |
+
controlnet_strength * depth_ratio,
|
| 1445 |
+
controlnet_strength * canny_ratio
|
| 1446 |
+
]
|
| 1447 |
+
|
| 1448 |
+
print(f"UI Strength: {ui_strength}")
|
| 1449 |
+
print(f"adj_strength: {adj_strength:.3f}")
|
| 1450 |
+
print(f"controlnet_strength: {controlnet_strength:.3f}")
|
| 1451 |
+
print(f"Depth: {depth_ratio*100:.1f}%, Canny: {canny_ratio*100:.1f}%")
|
| 1452 |
+
print(f"conditioning_scale: {conditioning_scale}")
|
| 1453 |
+
|
| 1454 |
+
|
| 1455 |
+
|
| 1456 |
if any(keyword in prompt_lower for keyword in anime_keywords):
|
| 1457 |
# Anime: Mehr Denoising für Stiländerungen
|
| 1458 |
adj_strength = 0.55 + (ui_strength * 0.3) # 0.2-1.0
|