Astridkraft commited on
Commit
655d032
·
verified ·
1 Parent(s): d38831a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -1452,6 +1452,39 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1452
  print(f" Conditioning Scale: [{conditioning_scale[0]:.3f}, {conditioning_scale[1]:.3f}]")
1453
 
1454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1455
 
1456
 
1457
  elif any(keyword in prompt_lower for keyword in drawing_keywords):
 
1452
  print(f" Conditioning Scale: [{conditioning_scale[0]:.3f}, {conditioning_scale[1]:.3f}]")
1453
 
1454
 
1455
+ if any(keyword in prompt_lower for keyword in anime_keywords):
1456
+ # Anime: Mehr Denoising für Stiländerungen
1457
+ adj_strength = 0.55 + (ui_strength * 0.3) # 0.2-1.0
1458
+
1459
+
1460
+ if ui_strength > 0.6: # Bei radikalen Änderungen
1461
+ controlnet_strength = 0.3 + (ui_strength * 0.4) # 0.3 → 0.66
1462
+ else: # Bei milden Änderungen
1463
+ controlnet_strength = 0.65 - (ui_strength * 0.3) # 0.65 → 0.35
1464
+
1465
+
1466
+ # Anime: Weniger Depth, mehr Canny
1467
+ depth_ratio = 0.7 - (ui_strength * 0.2) # 0.6 → 0.3
1468
+ canny_ratio = 0.1 + (ui_strength * 0.1) # 0.4 → 0.8
1469
+
1470
+ #Clipping
1471
+ adj_strength = max(0.3, min(adj_strength, 0.85))
1472
+ controlnet_strength = max(0.25, min(controlnet_strength, 0.75))
1473
+ depth_ratio = max(0.4, min(depth_ratio, 0.8))
1474
+ canny_ratio = max(0.05, min(canny_ratio, 0.15))
1475
+
1476
+
1477
+ conditioning_scale = [
1478
+ controlnet_strength * depth_ratio,
1479
+ controlnet_strength * canny_ratio
1480
+ ]
1481
+
1482
+ print(" 🎨 Anime-Modus: Mehr Freiheit für Stiländerungen")
1483
+ print(f" Strength: {adj_strength}, ControlNet: {controlnet_strength}")
1484
+ print(f" Depth: {depth_ratio*100}%, Canny: {canny_ratio*100}%")
1485
+ print(f" Conditioning Scale: [{conditioning_scale[0]:.3f}, {conditioning_scale[1]:.3f}]")
1486
+
1487
+
1488
 
1489
 
1490
  elif any(keyword in prompt_lower for keyword in drawing_keywords):