Astridkraft commited on
Commit
f5c19bf
·
verified ·
1 Parent(s): aacd5d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -15
app.py CHANGED
@@ -1159,17 +1159,28 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1159
  ui_strength = strength # Benenne um für Klarheit
1160
 
1161
  # 1. Basierend auf der UI-Stärke (strength) berechnen
1162
- adj_strength = ui_strength * 0.8
1163
- controlnet_strength = 0.5 - (ui_strength * 0.35)
1164
- pose_ratio = 0.75 - (ui_strength * 0.15)
1165
- canny_ratio = 0.25 + (ui_strength * 0.15)
1166
-
 
 
 
 
 
 
 
1167
  # 2. Werte auf sinnvolle Bereiche begrenzen (Clipping)
1168
- adj_strength = max(0.1, min(adj_strength, 0.8))
1169
- controlnet_strength = max(0.15, min(controlnet_strength, 0.5))
1170
- pose_ratio = max(0.5, min(pose_ratio, 0.8))
1171
- canny_ratio = max(0.2, min(canny_ratio, 0.5))
1172
-
 
 
 
 
1173
 
1174
  print(f"👤 Humanoid → Humanoid (UI-Stärke: {ui_strength})")
1175
  print(f" adj_strength: {adj_strength:.2f}, controlnet: {controlnet_strength:.2f}")
@@ -1183,6 +1194,11 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1183
  controlnet_strength = 0.5
1184
  pose_ratio = 0.10 # 10% Pose
1185
  canny_ratio = 0.90 # 90% Canny
 
 
 
 
 
1186
  print("📦 Gegenstand → Gegenstand → Ratio 25:75 (Pose:Canny)")
1187
 
1188
  # Anpassung für Mensch → Tier
@@ -1193,11 +1209,11 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1193
  canny_ratio = 0.5 # 50% Canny
1194
  print("🐾 Mensch → Tier → Ratio 50:50 (Pose:Canny)")
1195
 
1196
- # CONDITIONING SCALE BERECHNEN (genau wie environment_change)
1197
- conditioning_scale = [
1198
- controlnet_strength * pose_ratio, # OpenPose
1199
- controlnet_strength * canny_ratio # Canny
1200
- ]
1201
 
1202
  print(f"🎯 MODUS: Focus verändern")
1203
  print(f" Strength: {adj_strength}, ControlNet: {controlnet_strength}")
 
1159
  ui_strength = strength # Benenne um für Klarheit
1160
 
1161
  # 1. Basierend auf der UI-Stärke (strength) berechnen
1162
+ #adj_strength = ui_strength * 0.8
1163
+ #controlnet_strength = 0.5 - (ui_strength * 0.35)
1164
+ #pose_ratio = 0.75 - (ui_strength * 0.15)
1165
+ #canny_ratio = 0.25 + (ui_strength * 0.15)
1166
+
1167
+ adj_strength = ui_strength
1168
+ controlnet_strength = 0.0
1169
+ pose_ratio = 0.0
1170
+ canny_ratio = 0.0
1171
+
1172
+ conditioning_scale = [0.0, 0.0]
1173
+
1174
  # 2. Werte auf sinnvolle Bereiche begrenzen (Clipping)
1175
+ #adj_strength = max(0.1, min(adj_strength, 0.8))
1176
+ #controlnet_strength = max(0.15, min(controlnet_strength, 0.5))
1177
+ #pose_ratio = max(0.5, min(pose_ratio, 0.8))
1178
+ #canny_ratio = max(0.2, min(canny_ratio, 0.5))
1179
+
1180
+ #conditioning_scale = [
1181
+ # controlnet_strength * depth_ratio, # Depth-Gewichtung
1182
+ # controlnet_strength * canny_ratio # Canny-Gewichtung
1183
+ #]
1184
 
1185
  print(f"👤 Humanoid → Humanoid (UI-Stärke: {ui_strength})")
1186
  print(f" adj_strength: {adj_strength:.2f}, controlnet: {controlnet_strength:.2f}")
 
1194
  controlnet_strength = 0.5
1195
  pose_ratio = 0.10 # 10% Pose
1196
  canny_ratio = 0.90 # 90% Canny
1197
+
1198
+ conditioning_scale = [
1199
+ controlnet_strength * depth_ratio, # Depth-Gewichtung
1200
+ controlnet_strength * canny_ratio # Canny-Gewichtung
1201
+ ]
1202
  print("📦 Gegenstand → Gegenstand → Ratio 25:75 (Pose:Canny)")
1203
 
1204
  # Anpassung für Mensch → Tier
 
1209
  canny_ratio = 0.5 # 50% Canny
1210
  print("🐾 Mensch → Tier → Ratio 50:50 (Pose:Canny)")
1211
 
1212
+ # CONDITIONING SCALE BERECHNEN (genau wie environment_change)
1213
+ conditioning_scale = [
1214
+ controlnet_strength * pose_ratio, # OpenPose
1215
+ controlnet_strength * canny_ratio # Canny
1216
+ ]
1217
 
1218
  print(f"🎯 MODUS: Focus verändern")
1219
  print(f" Strength: {adj_strength}, ControlNet: {controlnet_strength}")