Astridkraft commited on
Commit
4e95608
·
verified ·
1 Parent(s): 444aa66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -1278,6 +1278,13 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1278
  # MEHR Depth (Maßstab/Tiefe erhalten)
1279
  depth_ratio = 0.8 - (ui_strength * 0.3) # Depth-Wert hält Maßstab und Boden (Emi groß, Liege klein - Emi im Meer)
1280
  canny_ratio = 1.0 - depth_ratio # erzwingt Kanten - hält dadurch an alter Umgebung fest - schlecht bei Umgebungswechsel
 
 
 
 
 
 
 
1281
 
1282
  conditioning_scale = [
1283
  controlnet_strength * depth_ratio,
 
1278
  # MEHR Depth (Maßstab/Tiefe erhalten)
1279
  depth_ratio = 0.8 - (ui_strength * 0.3) # Depth-Wert hält Maßstab und Boden (Emi groß, Liege klein - Emi im Meer)
1280
  canny_ratio = 1.0 - depth_ratio # erzwingt Kanten - hält dadurch an alter Umgebung fest - schlecht bei Umgebungswechsel
1281
+
1282
+ # Clipping verhindert extreme Werte, Controlnet hat immer etwas Einfluß sonst ist Pipline instabil
1283
+ # Für Naturszenen (Wald→Wüste, Meer→Tundra)
1284
+ adj_strength = max(0.3, min(adj_strength, 0.85))
1285
+ controlnet_strength = max(0.25, min(controlnet_strength, 0.65))
1286
+ depth_ratio = max(0.3, min(depth_ratio, 0.9)) # Depth nicht unter 30%
1287
+ canny_ratio = max(0.1, min(canny_ratio, 0.7)) # Canny nicht über 70%
1288
 
1289
  conditioning_scale = [
1290
  controlnet_strength * depth_ratio,