Astridkraft commited on
Commit
267cb12
·
verified ·
1 Parent(s): 478ac9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -0
app.py CHANGED
@@ -1055,6 +1055,69 @@ def img_to_image(image, prompt, neg_prompt, strength, steps, guidance_scale,
1055
 
1056
  # ===== PROMPT-BOOSTER FÜR DREI MODI =====
1057
  if mode == "face_only_change":
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  face_boosters = "(perfect face:1.2), (symmetrical face:1.1), realistic shaded perfect face, "
1059
 
1060
  if not any(keyword in prompt.lower() for keyword in
 
1055
 
1056
  # ===== PROMPT-BOOSTER FÜR DREI MODI =====
1057
  if mode == "face_only_change":
1058
+
1059
+ prompt_lower = prompt.lower()
1060
+
1061
+ front_face_keywords = [
1062
+ "portrait", "face", "eyes", "smile", "lips", "nose", "expression",
1063
+ "looking at camera", "frontal view", "headshot", "selfie", "close-up",
1064
+ "profile", "side view", "front", "frontal", "facing camera", "jawline"
1065
+ ]
1066
+
1067
+ back_head_keywords = [
1068
+ "back of head", "from behind", "rear view", "looking away",
1069
+ "turned away", "back view", "backside", "back", "rear",
1070
+ "hair only", "ponytail", "hairstyle", "hair", "back hair"
1071
+ ]
1072
+
1073
+ # Bestimme ob Gesicht vorne oder Hinterkopf vorne
1074
+ is_front_face = any(keyword in prompt_lower for keyword in front_face_keywords)
1075
+ is_back_head = any(keyword in prompt_lower for keyword in back_head_keywords)
1076
+
1077
+ # Fallback: Wenn keine spezifischen Keywords, annehmen es ist Gesicht
1078
+ if not is_front_face and not is_back_head:
1079
+ is_front_face = True # Standard: Gesicht vorne
1080
+ print(" ℹ️ Keine Gesicht/Hinterkopf-Keywords → Standard: Gesicht vorne")
1081
+
1082
+ print(f" 🎯 Gesichtserkenner für Boosters: Vorne={is_front_face}, Hinten={is_back_head}")
1083
+
1084
+ # NUR für frontale Gesichter Gesichts-Booster hinzufügen
1085
+ if is_front_face and not is_back_head:
1086
+ face_boosters = "(perfect face:1.2), (symmetrical face:1.1), realistic shaded perfect face, "
1087
+
1088
+ if not any(keyword in prompt_lower for keyword in
1089
+ ["perfect face", "symmetrical", "realistic face", "shaded face"]):
1090
+ enhanced_prompt = face_boosters + prompt
1091
+ print(f"👤 Gesichts-Booster hinzugefügt: {face_boosters}")
1092
+ else:
1093
+ enhanced_prompt = prompt
1094
+ print(f"👤 Benutzer hat bereits Gesichts-Booster im Prompt")
1095
+ else:
1096
+ # Keine Gesichts-Booster für Hinterkopf oder unklare Fälle
1097
+ enhanced_prompt = prompt
1098
+ if is_back_head:
1099
+ print(f"💇 Hinterkopf erkannt → Keine Gesichts-Booster")
1100
+ else:
1101
+ print(f"👤 Keine Gesichts-Booster (unspezifischer Prompt)")
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+
1121
  face_boosters = "(perfect face:1.2), (symmetrical face:1.1), realistic shaded perfect face, "
1122
 
1123
  if not any(keyword in prompt.lower() for keyword in