Update app.py
Browse files
app.py
CHANGED
|
@@ -1019,6 +1019,8 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1019 |
# OPTIMIERTE WERTE FÜR FOCUS_CHANGE
|
| 1020 |
adj_strength = min(0.6, strength * 1.05) # Konservativer (0.65)
|
| 1021 |
controlnet_weight = 0.85 # Stärkere ControlNet-Kontrolle
|
|
|
|
|
|
|
| 1022 |
pose_ratio = 0.8 # OpenPose dominiert
|
| 1023 |
canny_ratio = 0.2 # Canny unterstützt
|
| 1024 |
|
|
@@ -1056,7 +1058,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1056 |
nature_keywords = ["beach", "forest", "mountain", "ocean", "sky", "field", "landscape", "nature", "outdoor"]
|
| 1057 |
interior_keywords = ["office", "room", "interior", "kitchen", "bedroom", "living room", "indoor", "wall", "furniture"]
|
| 1058 |
|
| 1059 |
-
# Standard:
|
| 1060 |
depth_ratio = 0.9
|
| 1061 |
canny_ratio = 0.1
|
| 1062 |
|
|
@@ -1091,7 +1093,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1091 |
adj_strength = min(0.85, strength * 1.25)
|
| 1092 |
controlnet_strength = adj_strength * 0.5
|
| 1093 |
|
| 1094 |
-
# HIER FEHLEN DIE RATIOS -
|
| 1095 |
depth_ratio = 0.7 # Für Gesicht: Depth stärker
|
| 1096 |
canny_ratio = 0.3 # Canny leichter
|
| 1097 |
|
|
@@ -1168,29 +1170,7 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
|
|
| 1168 |
|
| 1169 |
# ===== CONTROLNET-GESTEUERTES INPAINTING DURCHFÜHREN =====
|
| 1170 |
print(f"🔄 Führe ControlNet-gesteuertes Inpainting durch...")
|
| 1171 |
-
|
| 1172 |
-
# Berechne die Gewichtung der Maps für Controlnet basierend auf dem Modus
|
| 1173 |
-
if keep_environment: # Depth + Canny
|
| 1174 |
-
if mode == "face_only_change":
|
| 1175 |
-
# Für Gesicht: Depth stärker, Canny leichter
|
| 1176 |
-
depth_ratio = 0.7
|
| 1177 |
-
canny_ratio = 0.3
|
| 1178 |
-
else: # environment_change
|
| 1179 |
-
# Für Umgebung: Ausgewogen
|
| 1180 |
-
depth_ratio = 0.6
|
| 1181 |
-
canny_ratio = 0.4
|
| 1182 |
-
|
| 1183 |
-
conditioning_scale = [
|
| 1184 |
-
controlnet_strength * depth_ratio,
|
| 1185 |
-
controlnet_strength * canny_ratio
|
| 1186 |
-
]
|
| 1187 |
-
|
| 1188 |
-
else: # OpenPose + Canny (nur focus_change)
|
| 1189 |
-
conditioning_scale = [
|
| 1190 |
-
controlnet_strength * pose_ratio,
|
| 1191 |
-
controlnet_strength * canny_ratio
|
| 1192 |
-
]
|
| 1193 |
-
|
| 1194 |
|
| 1195 |
result = pipe(
|
| 1196 |
prompt=enhanced_prompt,
|
|
|
|
| 1019 |
# OPTIMIERTE WERTE FÜR FOCUS_CHANGE
|
| 1020 |
adj_strength = min(0.6, strength * 1.05) # Konservativer (0.65)
|
| 1021 |
controlnet_weight = 0.85 # Stärkere ControlNet-Kontrolle
|
| 1022 |
+
|
| 1023 |
+
#Controlnet gesteuertes Inpainting
|
| 1024 |
pose_ratio = 0.8 # OpenPose dominiert
|
| 1025 |
canny_ratio = 0.2 # Canny unterstützt
|
| 1026 |
|
|
|
|
| 1058 |
nature_keywords = ["beach", "forest", "mountain", "ocean", "sky", "field", "landscape", "nature", "outdoor"]
|
| 1059 |
interior_keywords = ["office", "room", "interior", "kitchen", "bedroom", "living room", "indoor", "wall", "furniture"]
|
| 1060 |
|
| 1061 |
+
# Standard: Controlnet gesteuertes Inpainting wird genutzt wenn in Prompt nicht eines der folgenden keywords
|
| 1062 |
depth_ratio = 0.9
|
| 1063 |
canny_ratio = 0.1
|
| 1064 |
|
|
|
|
| 1093 |
adj_strength = min(0.85, strength * 1.25)
|
| 1094 |
controlnet_strength = adj_strength * 0.5
|
| 1095 |
|
| 1096 |
+
# HIER FEHLEN DIE RATIOS - Controlnet gesteuertes Inpainting:
|
| 1097 |
depth_ratio = 0.7 # Für Gesicht: Depth stärker
|
| 1098 |
canny_ratio = 0.3 # Canny leichter
|
| 1099 |
|
|
|
|
| 1170 |
|
| 1171 |
# ===== CONTROLNET-GESTEUERTES INPAINTING DURCHFÜHREN =====
|
| 1172 |
print(f"🔄 Führe ControlNet-gesteuertes Inpainting durch...")
|
| 1173 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1174 |
|
| 1175 |
result = pipe(
|
| 1176 |
prompt=enhanced_prompt,
|