Update app.py
Browse files
app.py
CHANGED
|
@@ -1100,13 +1100,17 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1100 |
|
| 1101 |
|
| 1102 |
elif mode == "environment_change":
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1103 |
keep_environment = True
|
| 1104 |
|
| 1105 |
# 1. Denoising: starke Neugenerierung
|
| 1106 |
adj_strength = 0.75 # Leicht runter auf Realismus
|
| 1107 |
|
| 1108 |
# 2. CONTROLNET-STÄRKE ERHÖHT
|
| 1109 |
-
controlnet_strength = 0.55
|
| 1110 |
|
| 1111 |
# 3. DYNAMISCHE DEPTH:CANNY RATIO BASIEREND AUF PROMPT
|
| 1112 |
prompt_lower = prompt.lower()
|
|
@@ -1115,7 +1119,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1115 |
nature_keywords = ["beach", "forest", "mountain", "ocean", "sky", "field", "landscape", "nature", "outdoor", "desert", "snow", "arctic"]
|
| 1116 |
interior_keywords = ["office", "room", "interior", "kitchen", "bedroom", "living room", "indoor", "wall", "furniture"]
|
| 1117 |
|
| 1118 |
-
# Standard:
|
| 1119 |
depth_ratio = 0.50 # 35%
|
| 1120 |
canny_ratio = 0.12 # 10%
|
| 1121 |
|
|
@@ -1130,7 +1134,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1130 |
# Anpassung für Naturszenen (maximale Flexibilität) - die optimalen UI-Werte: strength:0,72 , steps: 35 , guidance: 9-9,5
|
| 1131 |
elif any(keyword in prompt_lower for keyword in nature_keywords):
|
| 1132 |
adj_strength = 0.75
|
| 1133 |
-
controlnet_strength = 0.
|
| 1134 |
depth_ratio = 0.50 #Depth-Wert hält Maßstab und Boden (Emi groß, Liege klein - Emi im Meer)
|
| 1135 |
canny_ratio = 0.12 #erzwingt Kanten - hält dadurch an alter Umgebung fest - schlecht bei Umgebungswechsel
|
| 1136 |
print("🌳 Naturszene erkannt → Ratio 95:5 (Depth:Canny)")
|
|
|
|
| 1100 |
|
| 1101 |
|
| 1102 |
elif mode == "environment_change":
|
| 1103 |
+
# optimale UI-Werte:
|
| 1104 |
+
• # Strength: 0.72 – 0.78 → ideal: 0.75
|
| 1105 |
+
• # guidance (CFG): 8.5 – 9.5 → ideal: 9
|
| 1106 |
+
• # Steps: 34 – 38 → ideal: 35
|
| 1107 |
keep_environment = True
|
| 1108 |
|
| 1109 |
# 1. Denoising: starke Neugenerierung
|
| 1110 |
adj_strength = 0.75 # Leicht runter auf Realismus
|
| 1111 |
|
| 1112 |
# 2. CONTROLNET-STÄRKE ERHÖHT
|
| 1113 |
+
controlnet_strength = 0.55 #Inpaint kann bei Neugenerierung nicht so viel Kontrolle vertragen
|
| 1114 |
|
| 1115 |
# 3. DYNAMISCHE DEPTH:CANNY RATIO BASIEREND AUF PROMPT
|
| 1116 |
prompt_lower = prompt.lower()
|
|
|
|
| 1119 |
nature_keywords = ["beach", "forest", "mountain", "ocean", "sky", "field", "landscape", "nature", "outdoor", "desert", "snow", "arctic"]
|
| 1120 |
interior_keywords = ["office", "room", "interior", "kitchen", "bedroom", "living room", "indoor", "wall", "furniture"]
|
| 1121 |
|
| 1122 |
+
# Standard: wird genutzt wenn Prompt nicht eines der obigen keywords beinhaltet
|
| 1123 |
depth_ratio = 0.50 # 35%
|
| 1124 |
canny_ratio = 0.12 # 10%
|
| 1125 |
|
|
|
|
| 1134 |
# Anpassung für Naturszenen (maximale Flexibilität) - die optimalen UI-Werte: strength:0,72 , steps: 35 , guidance: 9-9,5
|
| 1135 |
elif any(keyword in prompt_lower for keyword in nature_keywords):
|
| 1136 |
adj_strength = 0.75
|
| 1137 |
+
controlnet_strength = 0.50
|
| 1138 |
depth_ratio = 0.50 #Depth-Wert hält Maßstab und Boden (Emi groß, Liege klein - Emi im Meer)
|
| 1139 |
canny_ratio = 0.12 #erzwingt Kanten - hält dadurch an alter Umgebung fest - schlecht bei Umgebungswechsel
|
| 1140 |
print("🌳 Naturszene erkannt → Ratio 95:5 (Depth:Canny)")
|