Update app.py
Browse files
app.py
CHANGED
|
@@ -1494,34 +1494,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1494 |
# Anime-HINTERKOPF
|
| 1495 |
depth_ratio = 0.65 + 0.20 * smoothstep(0.5, 0.9, ui_strength) # Niedriger
|
| 1496 |
canny_ratio = 1.0 - depth_ratio
|
| 1497 |
-
|
| 1498 |
-
|
| 1499 |
-
if any(keyword in prompt_lower for keyword in anime_keywords):
|
| 1500 |
-
print("🎨 ANIME-TRANSFORM-MODUS")
|
| 1501 |
-
|
| 1502 |
-
def smoothstep(min_val, max_val, x):
|
| 1503 |
-
x = max(0, min(1, (x - min_val) / (max_val - min_val)))
|
| 1504 |
-
return x * x * (3 - 2 * x)
|
| 1505 |
-
|
| 1506 |
-
# Basiseinstellungen für Anime
|
| 1507 |
-
adj_strength = 0.30 + 0.55 * smoothstep(0.35, 0.9, ui_strength)
|
| 1508 |
-
adj_strength = max(0.3, min(adj_strength, 0.85))
|
| 1509 |
-
|
| 1510 |
-
controlnet_strength = 0.30 + 0.52 * smoothstep(0.65, 0.9, ui_strength)
|
| 1511 |
-
controlnet_strength = max(0.25, min(controlnet_strength, 0.85))
|
| 1512 |
-
|
| 1513 |
-
# ANPASSUNG BASIEREND AUF GESICHT/HINTERKOPF
|
| 1514 |
-
if is_front_face:
|
| 1515 |
-
# Anime-GESICHT vorne
|
| 1516 |
-
depth_ratio = 0.65 + 0.15 * smoothstep(0.5, 0.9, ui_strength) # Höher für Gesichtsstruktur
|
| 1517 |
-
canny_ratio = 1.0 - depth_ratio
|
| 1518 |
-
print(" 👤 Anime-Gesicht (vorne): Mehr Depth für 3D-Struktur")
|
| 1519 |
-
|
| 1520 |
-
elif is_back_head:
|
| 1521 |
-
# Anime-HINTERKOPF
|
| 1522 |
-
depth_ratio = 0.65 + 0.20 * smoothstep(0.5, 0.9, ui_strength) # Niedriger
|
| 1523 |
-
canny_ratio = 1.0 - depth_ratio
|
| 1524 |
-
|
| 1525 |
# 2. CONTROLNET-BOOST AB 0.7 (neue Logik)
|
| 1526 |
if ui_strength <= 0.7:
|
| 1527 |
# Bis 0.7: normale Steigerung (wie getestet und gut)
|
|
@@ -1555,37 +1528,6 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1555 |
print(f"Depth: {depth_ratio*100:.1f}%, Canny: {canny_ratio*100:.1f}%")
|
| 1556 |
print(f"conditioning_scale: {conditioning_scale}")
|
| 1557 |
|
| 1558 |
-
|
| 1559 |
-
|
| 1560 |
-
|
| 1561 |
-
|
| 1562 |
-
|
| 1563 |
-
|
| 1564 |
-
|
| 1565 |
-
|
| 1566 |
-
|
| 1567 |
-
|
| 1568 |
-
|
| 1569 |
-
|
| 1570 |
-
|
| 1571 |
-
|
| 1572 |
-
|
| 1573 |
-
else:
|
| 1574 |
-
# Standard-Anime (Fallback)
|
| 1575 |
-
depth_ratio = 0.55 + 0.15 * smoothstep(0.5, 0.9, ui_strength)
|
| 1576 |
-
canny_ratio = 1.0 - depth_ratio
|
| 1577 |
-
|
| 1578 |
-
conditioning_scale = [
|
| 1579 |
-
controlnet_strength * depth_ratio,
|
| 1580 |
-
controlnet_strength * canny_ratio
|
| 1581 |
-
]
|
| 1582 |
-
|
| 1583 |
-
print(f"UI Strength: {ui_strength}")
|
| 1584 |
-
print(f"adj_strength: {adj_strength:.3f}")
|
| 1585 |
-
print(f"controlnet_strength: {controlnet_strength:.3f}")
|
| 1586 |
-
print(f"Depth: {depth_ratio*100:.1f}%, Canny: {canny_ratio*100:.1f}%")
|
| 1587 |
-
print(f"conditioning_scale: {conditioning_scale}")
|
| 1588 |
-
|
| 1589 |
|
| 1590 |
elif any(keyword in prompt_lower for keyword in drawing_keywords):
|
| 1591 |
# Weniger Denoising für anatomische Korrektheit (nicht getestet)
|
|
|
|
| 1494 |
# Anime-HINTERKOPF
|
| 1495 |
depth_ratio = 0.65 + 0.20 * smoothstep(0.5, 0.9, ui_strength) # Niedriger
|
| 1496 |
canny_ratio = 1.0 - depth_ratio
|
| 1497 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1498 |
# 2. CONTROLNET-BOOST AB 0.7 (neue Logik)
|
| 1499 |
if ui_strength <= 0.7:
|
| 1500 |
# Bis 0.7: normale Steigerung (wie getestet und gut)
|
|
|
|
| 1528 |
print(f"Depth: {depth_ratio*100:.1f}%, Canny: {canny_ratio*100:.1f}%")
|
| 1529 |
print(f"conditioning_scale: {conditioning_scale}")
|
| 1530 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1531 |
|
| 1532 |
elif any(keyword in prompt_lower for keyword in drawing_keywords):
|
| 1533 |
# Weniger Denoising für anatomische Korrektheit (nicht getestet)
|