Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,6 @@ class UltraSupremeAnalyzer:
|
|
| 46 |
"senior": ["senior", "older", "elderly", "aged", "vintage", "seasoned"],
|
| 47 |
"elderly": ["elderly", "old", "ancient", "weathered", "aged", "gray", "grey", "white hair", "silver", "wrinkled", "lined", "creased", "time-worn", "distinguished by age"]
|
| 48 |
}
|
| 49 |
-
|
| 50 |
self.ultra_facial_analysis = {
|
| 51 |
"eye_features": {
|
| 52 |
"shape": ["round eyes", "almond eyes", "narrow eyes", "wide eyes", "deep-set eyes", "prominent eyes"],
|
|
@@ -91,7 +90,6 @@ class UltraSupremeAnalyzer:
|
|
| 91 |
"headwear": ["hat", "cap", "beret", "headband", "turban", "hood", "helmet", "crown", "headpiece"],
|
| 92 |
"eyewear": ["glasses", "spectacles", "sunglasses", "reading glasses", "wire-frame glasses", "thick-rimmed glasses", "designer glasses", "vintage glasses"],
|
| 93 |
"clothing_types": ["suit", "jacket", "shirt", "dress", "robe", "uniform", "casual wear", "formal wear", "business attire"],
|
| 94 |
-
"clothing_colors": ["black", "white", "gray", "blue", "red", "green", "brown", "navy", "dark", "light"],
|
| 95 |
"clothing_styles": ["formal", "casual", "business", "traditional", "modern", "vintage", "classic", "contemporary"],
|
| 96 |
"accessories": ["jewelry", "watch", "necklace", "ring", "bracelet", "earrings", "pin", "brooch"]
|
| 97 |
}
|
|
@@ -125,7 +123,6 @@ class UltraSupremeAnalyzer:
|
|
| 125 |
"eye_contact": ["looking at camera", "looking away", "direct gaze", "averted gaze", "looking down", "looking up"],
|
| 126 |
"overall_demeanor": ["confident", "reserved", "approachable", "authoritative", "gentle", "stern", "relaxed", "tense"]
|
| 127 |
}
|
| 128 |
-
|
| 129 |
self.composition_photography_ultra = {
|
| 130 |
"shot_types": ["close-up", "medium shot", "wide shot", "extreme close-up", "portrait shot", "headshot", "bust shot", "full body"],
|
| 131 |
"angles": ["eye level", "high angle", "low angle", "bird's eye", "worm's eye", "Dutch angle"],
|
|
@@ -245,9 +242,13 @@ class UltraSupremeAnalyzer:
|
|
| 245 |
if isinstance(items, list):
|
| 246 |
for item in items:
|
| 247 |
if item in combined_analysis["combined"]:
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
setting_scores = {}
|
| 252 |
for main_setting, sub_settings in self.environmental_ultra_analysis.items():
|
| 253 |
if isinstance(sub_settings, dict):
|
|
@@ -269,7 +270,8 @@ class UltraSupremeAnalyzer:
|
|
| 269 |
for pose_category, indicators in self.pose_body_language_ultra.items():
|
| 270 |
for indicator in indicators:
|
| 271 |
if indicator in combined_analysis["combined"]:
|
| 272 |
-
ultra_result["pose_composition"]
|
|
|
|
| 273 |
|
| 274 |
# TECHNICAL PHOTOGRAPHY ANALYSIS
|
| 275 |
for shot_type in self.composition_photography_ultra["shot_types"]:
|
|
@@ -285,165 +287,163 @@ class UltraSupremeAnalyzer:
|
|
| 285 |
|
| 286 |
return ultra_result
|
| 287 |
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
if ultra_analysis["demographic"]["cultural_religious"]:
|
| 296 |
-
|
| 297 |
-
if ultra_analysis["demographic"]["age_category"] and ultra_analysis["demographic"]["age_category"] != "middle_aged":
|
| 298 |
-
subject_desc.append(ultra_analysis["demographic"]["age_category"].replace("_", " "))
|
| 299 |
-
if ultra_analysis["demographic"]["gender"]:
|
| 300 |
-
subject_desc.append(ultra_analysis["demographic"]["gender"])
|
| 301 |
-
|
| 302 |
-
if subject_desc:
|
| 303 |
-
full_subject = " ".join(subject_desc)
|
| 304 |
-
article = "An" if full_subject[0].lower() in 'aeiou' else "A"
|
| 305 |
-
else:
|
| 306 |
-
article = "A"
|
| 307 |
-
components.append(article)
|
| 308 |
-
|
| 309 |
-
# 2. ULTRA CONTEXTUAL ADJECTIVES (max 2-3 per Flux rules)
|
| 310 |
-
adjectives = []
|
| 311 |
-
|
| 312 |
-
# Age-based adjectives
|
| 313 |
-
age_cat = ultra_analysis["demographic"]["age_category"]
|
| 314 |
-
if age_cat and age_cat in self.quality_descriptors_ultra["based_on_age"]:
|
| 315 |
-
adjectives.extend(self.quality_descriptors_ultra["based_on_age"][age_cat][:2])
|
| 316 |
-
|
| 317 |
-
# Emotion-based adjectives
|
| 318 |
-
emotion = ultra_analysis["emotional_state"]["primary_emotion"]
|
| 319 |
-
if emotion and emotion in self.quality_descriptors_ultra["based_on_emotion"]:
|
| 320 |
-
adjectives.extend(self.quality_descriptors_ultra["based_on_emotion"][emotion][:1])
|
| 321 |
-
|
| 322 |
-
# Default if none found
|
| 323 |
-
if not adjectives:
|
| 324 |
-
adjectives = ["distinguished", "professional"]
|
| 325 |
-
|
| 326 |
-
components.extend(adjectives[:2]) # Flux rule: max 2-3 adjectives
|
| 327 |
-
|
| 328 |
-
# 3. ULTRA ENHANCED SUBJECT
|
| 329 |
-
if subject_desc:
|
| 330 |
-
components.append(" ".join(subject_desc))
|
| 331 |
-
else:
|
| 332 |
-
components.append("person")
|
| 333 |
-
|
| 334 |
-
# 4. ULTRA DETAILED FACIAL FEATURES
|
| 335 |
-
facial_details = []
|
| 336 |
-
|
| 337 |
-
# Eyes
|
| 338 |
-
if ultra_analysis["facial_ultra"]["eyes"]:
|
| 339 |
-
eye_desc = ultra_analysis["facial_ultra"]["eyes"][0]
|
| 340 |
-
facial_details.append(f"with {eye_desc}")
|
| 341 |
-
|
| 342 |
-
# Facial hair with ultra detail
|
| 343 |
-
if ultra_analysis["facial_ultra"]["facial_hair"]:
|
| 344 |
-
beard_details = ultra_analysis["facial_ultra"]["facial_hair"]
|
| 345 |
-
if any("silver" in detail or "gray" in detail or "grey" in detail for detail in beard_details):
|
| 346 |
-
facial_details.append("with a distinguished silver beard")
|
| 347 |
-
elif any("beard" in detail for detail in beard_details):
|
| 348 |
-
facial_details.append("with a full well-groomed beard")
|
| 349 |
-
|
| 350 |
-
if facial_details:
|
| 351 |
-
components.extend(facial_details)
|
| 352 |
-
|
| 353 |
-
# 5. CLOTHING AND ACCESSORIES ULTRA
|
| 354 |
-
clothing_details = []
|
| 355 |
-
|
| 356 |
-
# Eyewear
|
| 357 |
-
if ultra_analysis["clothing_accessories"]["eyewear"]:
|
| 358 |
-
eyewear = ultra_analysis["clothing_accessories"]["eyewear"][0]
|
| 359 |
-
clothing_details.append(f"wearing {eyewear}")
|
| 360 |
-
|
| 361 |
-
# Headwear
|
| 362 |
-
if ultra_analysis["clothing_accessories"]["headwear"]:
|
| 363 |
-
headwear = ultra_analysis["clothing_accessories"]["headwear"][0]
|
| 364 |
-
if ultra_analysis["demographic"]["cultural_religious"]:
|
| 365 |
-
clothing_details.append("wearing a traditional black hat")
|
| 366 |
-
else:
|
| 367 |
-
clothing_details.append(f"wearing a {headwear}")
|
| 368 |
-
|
| 369 |
-
if clothing_details:
|
| 370 |
-
components.extend(clothing_details)
|
| 371 |
-
|
| 372 |
-
# 6. ULTRA POSE AND BODY LANGUAGE
|
| 373 |
-
pose_description = "positioned with natural dignity"
|
| 374 |
-
|
| 375 |
-
if ultra_analysis["pose_composition"]["posture"]:
|
| 376 |
-
posture = ultra_analysis["pose_composition"]["posture"][0]
|
| 377 |
-
pose_description = f"maintaining {posture}"
|
| 378 |
-
elif ultra_analysis["technical_analysis"]["shot_type"] == "portrait":
|
| 379 |
-
pose_description = "captured in contemplative portrait pose"
|
| 380 |
-
|
| 381 |
-
components.append(pose_description)
|
| 382 |
-
|
| 383 |
-
# 7. ULTRA ENVIRONMENTAL CONTEXT
|
| 384 |
-
environment_desc = "in a thoughtfully composed environment"
|
| 385 |
-
|
| 386 |
-
if ultra_analysis["environmental"]["setting_type"]:
|
| 387 |
-
setting_map = {
|
| 388 |
-
"residential": "in an intimate home setting",
|
| 389 |
-
"office": "in a professional office environment",
|
| 390 |
-
"religious": "in a sacred traditional space",
|
| 391 |
-
"formal": "in a distinguished formal setting"
|
| 392 |
-
}
|
| 393 |
-
environment_desc = setting_map.get(ultra_analysis["environmental"]["setting_type"], "in a carefully arranged professional setting")
|
| 394 |
-
|
| 395 |
-
components.append(environment_desc)
|
| 396 |
-
|
| 397 |
-
# 8. ULTRA SOPHISTICATED LIGHTING
|
| 398 |
-
lighting_desc = "illuminated by sophisticated portrait lighting that emphasizes character and facial texture"
|
| 399 |
-
|
| 400 |
-
if ultra_analysis["environmental"]["lighting_analysis"]:
|
| 401 |
-
primary_light = ultra_analysis["environmental"]["lighting_analysis"][0]
|
| 402 |
-
if "dramatic" in primary_light:
|
| 403 |
-
lighting_desc = "bathed in dramatic chiaroscuro lighting that creates compelling depth and shadow play"
|
| 404 |
-
elif "natural" in primary_light or "window" in primary_light:
|
| 405 |
-
lighting_desc = "graced by gentle natural lighting that brings out intricate facial details and warmth"
|
| 406 |
-
elif "soft" in primary_light:
|
| 407 |
-
lighting_desc = "softly illuminated to reveal nuanced expressions and character"
|
| 408 |
-
|
| 409 |
-
components.append(lighting_desc)
|
| 410 |
-
|
| 411 |
-
# 9. ULTRA TECHNICAL SPECIFICATIONS
|
| 412 |
-
if ultra_analysis["technical_analysis"]["shot_type"] in ["portrait", "headshot", "close-up"]:
|
| 413 |
-
camera_setup = "Shot on Phase One XF IQ4, 85mm f/1.4 lens, f/2.8 aperture"
|
| 414 |
-
elif ultra_analysis["demographic"]["cultural_religious"]:
|
| 415 |
-
camera_setup = "Shot on Hasselblad X2D, 90mm lens, f/2.8 aperture"
|
| 416 |
else:
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
|
| 445 |
-
|
| 446 |
-
|
| 447 |
|
| 448 |
score = 0
|
| 449 |
breakdown = {}
|
|
@@ -497,9 +497,7 @@ class UltraSupremeAnalyzer:
|
|
| 497 |
breakdown["environmental"] = env_score
|
| 498 |
|
| 499 |
return min(score, 100), breakdown
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
class UltraSupremeOptimizer:
|
| 503 |
def __init__(self):
|
| 504 |
self.interrogator = None
|
| 505 |
self.analyzer = UltraSupremeAnalyzer()
|
|
@@ -596,8 +594,7 @@ class UltraSupremeOptimizer:
|
|
| 596 |
gc.collect()
|
| 597 |
else:
|
| 598 |
torch.cuda.empty_cache()
|
| 599 |
-
|
| 600 |
-
# ULTRA COMPREHENSIVE ANALYSIS REPORT
|
| 601 |
gpu_status = "⚡ ZeroGPU" if torch.cuda.is_available() else "💻 CPU"
|
| 602 |
|
| 603 |
# Format detected elements
|
|
@@ -631,6 +628,7 @@ class UltraSupremeOptimizer:
|
|
| 631 |
|
| 632 |
# Initialize the optimizer
|
| 633 |
optimizer = UltraSupremeOptimizer()
|
|
|
|
| 634 |
def process_ultra_supreme_analysis(image):
|
| 635 |
"""Ultra supreme analysis wrapper"""
|
| 636 |
try:
|
|
@@ -675,8 +673,7 @@ def clear_outputs():
|
|
| 675 |
if torch.cuda.is_available():
|
| 676 |
torch.cuda.empty_cache()
|
| 677 |
return "", "", '<div style="text-align: center; padding: 1rem;"><div style="font-size: 2rem; color: #ccc;">--</div><div style="font-size: 0.875rem; color: #999;">Ultra Supreme Score</div></div>'
|
| 678 |
-
|
| 679 |
-
def create_interface():
|
| 680 |
css = """
|
| 681 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
| 682 |
|
|
@@ -730,6 +727,7 @@ def create_interface():
|
|
| 730 |
margin: 0 !important;
|
| 731 |
position: relative;
|
| 732 |
z-index: 2;
|
|
|
|
| 733 |
}
|
| 734 |
|
| 735 |
.prompt-output {
|
|
@@ -748,6 +746,21 @@ def create_interface():
|
|
| 748 |
box-shadow: 0 25px 60px -5px rgba(0, 0, 0, 0.15) !important;
|
| 749 |
transform: translateY(-2px) !important;
|
| 750 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 751 |
"""
|
| 752 |
|
| 753 |
with gr.Blocks(
|
|
@@ -840,7 +853,7 @@ def create_interface():
|
|
| 840 |
understanding and applies research-validated Flux rules with supreme intelligence.
|
| 841 |
|
| 842 |
**🔬 Pariente AI Research Laboratory** • **🚀 Ultra Supreme Intelligence Engine**
|
| 843 |
-
""")
|
| 844 |
|
| 845 |
return interface
|
| 846 |
|
|
|
|
| 46 |
"senior": ["senior", "older", "elderly", "aged", "vintage", "seasoned"],
|
| 47 |
"elderly": ["elderly", "old", "ancient", "weathered", "aged", "gray", "grey", "white hair", "silver", "wrinkled", "lined", "creased", "time-worn", "distinguished by age"]
|
| 48 |
}
|
|
|
|
| 49 |
self.ultra_facial_analysis = {
|
| 50 |
"eye_features": {
|
| 51 |
"shape": ["round eyes", "almond eyes", "narrow eyes", "wide eyes", "deep-set eyes", "prominent eyes"],
|
|
|
|
| 90 |
"headwear": ["hat", "cap", "beret", "headband", "turban", "hood", "helmet", "crown", "headpiece"],
|
| 91 |
"eyewear": ["glasses", "spectacles", "sunglasses", "reading glasses", "wire-frame glasses", "thick-rimmed glasses", "designer glasses", "vintage glasses"],
|
| 92 |
"clothing_types": ["suit", "jacket", "shirt", "dress", "robe", "uniform", "casual wear", "formal wear", "business attire"],
|
|
|
|
| 93 |
"clothing_styles": ["formal", "casual", "business", "traditional", "modern", "vintage", "classic", "contemporary"],
|
| 94 |
"accessories": ["jewelry", "watch", "necklace", "ring", "bracelet", "earrings", "pin", "brooch"]
|
| 95 |
}
|
|
|
|
| 123 |
"eye_contact": ["looking at camera", "looking away", "direct gaze", "averted gaze", "looking down", "looking up"],
|
| 124 |
"overall_demeanor": ["confident", "reserved", "approachable", "authoritative", "gentle", "stern", "relaxed", "tense"]
|
| 125 |
}
|
|
|
|
| 126 |
self.composition_photography_ultra = {
|
| 127 |
"shot_types": ["close-up", "medium shot", "wide shot", "extreme close-up", "portrait shot", "headshot", "bust shot", "full body"],
|
| 128 |
"angles": ["eye level", "high angle", "low angle", "bird's eye", "worm's eye", "Dutch angle"],
|
|
|
|
| 242 |
if isinstance(items, list):
|
| 243 |
for item in items:
|
| 244 |
if item in combined_analysis["combined"]:
|
| 245 |
+
if category == "clothing_types":
|
| 246 |
+
ultra_result["clothing_accessories"]["clothing"].append(item)
|
| 247 |
+
elif category == "clothing_styles":
|
| 248 |
+
ultra_result["clothing_accessories"]["clothing"].append(item)
|
| 249 |
+
elif category in ["headwear", "eyewear", "accessories"]:
|
| 250 |
+
ultra_result["clothing_accessories"][category].append(item)
|
| 251 |
+
# ENVIRONMENTAL ULTRA ANALYSIS
|
| 252 |
setting_scores = {}
|
| 253 |
for main_setting, sub_settings in self.environmental_ultra_analysis.items():
|
| 254 |
if isinstance(sub_settings, dict):
|
|
|
|
| 270 |
for pose_category, indicators in self.pose_body_language_ultra.items():
|
| 271 |
for indicator in indicators:
|
| 272 |
if indicator in combined_analysis["combined"]:
|
| 273 |
+
if pose_category in ultra_result["pose_composition"]:
|
| 274 |
+
ultra_result["pose_composition"][pose_category].append(indicator)
|
| 275 |
|
| 276 |
# TECHNICAL PHOTOGRAPHY ANALYSIS
|
| 277 |
for shot_type in self.composition_photography_ultra["shot_types"]:
|
|
|
|
| 287 |
|
| 288 |
return ultra_result
|
| 289 |
|
| 290 |
+
def build_ultra_supreme_prompt(self, ultra_analysis, clip_results):
|
| 291 |
+
"""BUILD ULTRA SUPREME FLUX PROMPT - ABSOLUTE MAXIMUM QUALITY"""
|
| 292 |
+
|
| 293 |
+
components = []
|
| 294 |
+
|
| 295 |
+
# 1. ULTRA INTELLIGENT ARTICLE SELECTION
|
| 296 |
+
subject_desc = []
|
| 297 |
+
if ultra_analysis["demographic"]["cultural_religious"]:
|
| 298 |
+
subject_desc.extend(ultra_analysis["demographic"]["cultural_religious"][:1])
|
| 299 |
+
if ultra_analysis["demographic"]["age_category"] and ultra_analysis["demographic"]["age_category"] != "middle_aged":
|
| 300 |
+
subject_desc.append(ultra_analysis["demographic"]["age_category"].replace("_", " "))
|
| 301 |
+
if ultra_analysis["demographic"]["gender"]:
|
| 302 |
+
subject_desc.append(ultra_analysis["demographic"]["gender"])
|
| 303 |
+
|
| 304 |
+
if subject_desc:
|
| 305 |
+
full_subject = " ".join(subject_desc)
|
| 306 |
+
article = "An" if full_subject[0].lower() in 'aeiou' else "A"
|
| 307 |
+
else:
|
| 308 |
+
article = "A"
|
| 309 |
+
components.append(article)
|
| 310 |
+
|
| 311 |
+
# 2. ULTRA CONTEXTUAL ADJECTIVES (max 2-3 per Flux rules)
|
| 312 |
+
adjectives = []
|
| 313 |
+
|
| 314 |
+
# Age-based adjectives
|
| 315 |
+
age_cat = ultra_analysis["demographic"]["age_category"]
|
| 316 |
+
if age_cat and age_cat in self.quality_descriptors_ultra["based_on_age"]:
|
| 317 |
+
adjectives.extend(self.quality_descriptors_ultra["based_on_age"][age_cat][:2])
|
| 318 |
+
|
| 319 |
+
# Emotion-based adjectives
|
| 320 |
+
emotion = ultra_analysis["emotional_state"]["primary_emotion"]
|
| 321 |
+
if emotion and emotion in self.quality_descriptors_ultra["based_on_emotion"]:
|
| 322 |
+
adjectives.extend(self.quality_descriptors_ultra["based_on_emotion"][emotion][:1])
|
| 323 |
+
|
| 324 |
+
# Default if none found
|
| 325 |
+
if not adjectives:
|
| 326 |
+
adjectives = ["distinguished", "professional"]
|
| 327 |
+
|
| 328 |
+
components.extend(adjectives[:2]) # Flux rule: max 2-3 adjectives
|
| 329 |
+
# 3. ULTRA ENHANCED SUBJECT
|
| 330 |
+
if subject_desc:
|
| 331 |
+
components.append(" ".join(subject_desc))
|
| 332 |
+
else:
|
| 333 |
+
components.append("person")
|
| 334 |
+
|
| 335 |
+
# 4. ULTRA DETAILED FACIAL FEATURES
|
| 336 |
+
facial_details = []
|
| 337 |
+
|
| 338 |
+
# Eyes
|
| 339 |
+
if ultra_analysis["facial_ultra"]["eyes"]:
|
| 340 |
+
eye_desc = ultra_analysis["facial_ultra"]["eyes"][0]
|
| 341 |
+
facial_details.append(f"with {eye_desc}")
|
| 342 |
+
|
| 343 |
+
# Facial hair with ultra detail
|
| 344 |
+
if ultra_analysis["facial_ultra"]["facial_hair"]:
|
| 345 |
+
beard_details = ultra_analysis["facial_ultra"]["facial_hair"]
|
| 346 |
+
if any("silver" in detail or "gray" in detail or "grey" in detail for detail in beard_details):
|
| 347 |
+
facial_details.append("with a distinguished silver beard")
|
| 348 |
+
elif any("beard" in detail for detail in beard_details):
|
| 349 |
+
facial_details.append("with a full well-groomed beard")
|
| 350 |
+
|
| 351 |
+
if facial_details:
|
| 352 |
+
components.extend(facial_details)
|
| 353 |
+
|
| 354 |
+
# 5. CLOTHING AND ACCESSORIES ULTRA
|
| 355 |
+
clothing_details = []
|
| 356 |
+
|
| 357 |
+
# Eyewear
|
| 358 |
+
if ultra_analysis["clothing_accessories"]["eyewear"]:
|
| 359 |
+
eyewear = ultra_analysis["clothing_accessories"]["eyewear"][0]
|
| 360 |
+
clothing_details.append(f"wearing {eyewear}")
|
| 361 |
+
|
| 362 |
+
# Headwear
|
| 363 |
+
if ultra_analysis["clothing_accessories"]["headwear"]:
|
| 364 |
+
headwear = ultra_analysis["clothing_accessories"]["headwear"][0]
|
| 365 |
if ultra_analysis["demographic"]["cultural_religious"]:
|
| 366 |
+
clothing_details.append("wearing a traditional black hat")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
else:
|
| 368 |
+
clothing_details.append(f"wearing a {headwear}")
|
| 369 |
+
|
| 370 |
+
if clothing_details:
|
| 371 |
+
components.extend(clothing_details)
|
| 372 |
+
|
| 373 |
+
# 6. ULTRA POSE AND BODY LANGUAGE
|
| 374 |
+
pose_description = "positioned with natural dignity"
|
| 375 |
+
|
| 376 |
+
if ultra_analysis["pose_composition"]["posture"]:
|
| 377 |
+
posture = ultra_analysis["pose_composition"]["posture"][0]
|
| 378 |
+
pose_description = f"maintaining {posture}"
|
| 379 |
+
elif ultra_analysis["technical_analysis"]["shot_type"] == "portrait":
|
| 380 |
+
pose_description = "captured in contemplative portrait pose"
|
| 381 |
+
|
| 382 |
+
components.append(pose_description)
|
| 383 |
+
|
| 384 |
+
# 7. ULTRA ENVIRONMENTAL CONTEXT
|
| 385 |
+
environment_desc = "in a thoughtfully composed environment"
|
| 386 |
+
|
| 387 |
+
if ultra_analysis["environmental"]["setting_type"]:
|
| 388 |
+
setting_map = {
|
| 389 |
+
"residential": "in an intimate home setting",
|
| 390 |
+
"office": "in a professional office environment",
|
| 391 |
+
"religious": "in a sacred traditional space",
|
| 392 |
+
"formal": "in a distinguished formal setting"
|
| 393 |
+
}
|
| 394 |
+
environment_desc = setting_map.get(ultra_analysis["environmental"]["setting_type"], "in a carefully arranged professional setting")
|
| 395 |
+
|
| 396 |
+
components.append(environment_desc)
|
| 397 |
+
|
| 398 |
+
# 8. ULTRA SOPHISTICATED LIGHTING
|
| 399 |
+
lighting_desc = "illuminated by sophisticated portrait lighting that emphasizes character and facial texture"
|
| 400 |
+
|
| 401 |
+
if ultra_analysis["environmental"]["lighting_analysis"]:
|
| 402 |
+
primary_light = ultra_analysis["environmental"]["lighting_analysis"][0]
|
| 403 |
+
if "dramatic" in primary_light:
|
| 404 |
+
lighting_desc = "bathed in dramatic chiaroscuro lighting that creates compelling depth and shadow play"
|
| 405 |
+
elif "natural" in primary_light or "window" in primary_light:
|
| 406 |
+
lighting_desc = "graced by gentle natural lighting that brings out intricate facial details and warmth"
|
| 407 |
+
elif "soft" in primary_light:
|
| 408 |
+
lighting_desc = "softly illuminated to reveal nuanced expressions and character"
|
| 409 |
+
|
| 410 |
+
components.append(lighting_desc)
|
| 411 |
+
# 9. ULTRA TECHNICAL SPECIFICATIONS
|
| 412 |
+
if ultra_analysis["technical_analysis"]["shot_type"] in ["portrait", "headshot", "close-up"]:
|
| 413 |
+
camera_setup = "Shot on Phase One XF IQ4, 85mm f/1.4 lens, f/2.8 aperture"
|
| 414 |
+
elif ultra_analysis["demographic"]["cultural_religious"]:
|
| 415 |
+
camera_setup = "Shot on Hasselblad X2D, 90mm lens, f/2.8 aperture"
|
| 416 |
+
else:
|
| 417 |
+
camera_setup = "Shot on Phase One XF, 80mm lens, f/4 aperture"
|
| 418 |
+
|
| 419 |
+
components.append(camera_setup)
|
| 420 |
+
|
| 421 |
+
# 10. ULTRA QUALITY DESIGNATION
|
| 422 |
+
quality_designation = "professional portrait photography"
|
| 423 |
+
|
| 424 |
+
if ultra_analysis["demographic"]["cultural_religious"]:
|
| 425 |
+
quality_designation = "fine art documentary photography"
|
| 426 |
+
elif ultra_analysis["emotional_state"]["primary_emotion"]:
|
| 427 |
+
quality_designation = "expressive portrait photography"
|
| 428 |
+
|
| 429 |
+
components.append(quality_designation)
|
| 430 |
+
|
| 431 |
+
# ULTRA FINAL ASSEMBLY
|
| 432 |
+
prompt = ", ".join(components)
|
| 433 |
+
|
| 434 |
+
# Ultra cleaning and optimization
|
| 435 |
+
prompt = re.sub(r'\s+', ' ', prompt)
|
| 436 |
+
prompt = re.sub(r',\s*,+', ',', prompt)
|
| 437 |
+
prompt = re.sub(r'\s*,\s*', ', ', prompt)
|
| 438 |
+
prompt = prompt.replace(" ,", ",")
|
| 439 |
+
|
| 440 |
+
if prompt:
|
| 441 |
+
prompt = prompt[0].upper() + prompt[1:]
|
| 442 |
+
|
| 443 |
+
return prompt
|
| 444 |
|
| 445 |
+
def calculate_ultra_supreme_score(self, prompt, ultra_analysis):
|
| 446 |
+
"""ULTRA SUPREME INTELLIGENCE SCORING"""
|
| 447 |
|
| 448 |
score = 0
|
| 449 |
breakdown = {}
|
|
|
|
| 497 |
breakdown["environmental"] = env_score
|
| 498 |
|
| 499 |
return min(score, 100), breakdown
|
| 500 |
+
class UltraSupremeOptimizer:
|
|
|
|
|
|
|
| 501 |
def __init__(self):
|
| 502 |
self.interrogator = None
|
| 503 |
self.analyzer = UltraSupremeAnalyzer()
|
|
|
|
| 594 |
gc.collect()
|
| 595 |
else:
|
| 596 |
torch.cuda.empty_cache()
|
| 597 |
+
# ULTRA COMPREHENSIVE ANALYSIS REPORT
|
|
|
|
| 598 |
gpu_status = "⚡ ZeroGPU" if torch.cuda.is_available() else "💻 CPU"
|
| 599 |
|
| 600 |
# Format detected elements
|
|
|
|
| 628 |
|
| 629 |
# Initialize the optimizer
|
| 630 |
optimizer = UltraSupremeOptimizer()
|
| 631 |
+
|
| 632 |
def process_ultra_supreme_analysis(image):
|
| 633 |
"""Ultra supreme analysis wrapper"""
|
| 634 |
try:
|
|
|
|
| 673 |
if torch.cuda.is_available():
|
| 674 |
torch.cuda.empty_cache()
|
| 675 |
return "", "", '<div style="text-align: center; padding: 1rem;"><div style="font-size: 2rem; color: #ccc;">--</div><div style="font-size: 0.875rem; color: #999;">Ultra Supreme Score</div></div>'
|
| 676 |
+
def create_interface():
|
|
|
|
| 677 |
css = """
|
| 678 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
| 679 |
|
|
|
|
| 727 |
margin: 0 !important;
|
| 728 |
position: relative;
|
| 729 |
z-index: 2;
|
| 730 |
+
color: #ffffff !important;
|
| 731 |
}
|
| 732 |
|
| 733 |
.prompt-output {
|
|
|
|
| 746 |
box-shadow: 0 25px 60px -5px rgba(0, 0, 0, 0.15) !important;
|
| 747 |
transform: translateY(-2px) !important;
|
| 748 |
}
|
| 749 |
+
|
| 750 |
+
/* Fix para texto en el footer que aparece blanco sobre blanco */
|
| 751 |
+
footer, .footer, [class*="footer"] {
|
| 752 |
+
color: #374151 !important;
|
| 753 |
+
}
|
| 754 |
+
|
| 755 |
+
/* Asegurar que todo el texto del footer sea visible */
|
| 756 |
+
footer *, .footer *, [class*="footer"] * {
|
| 757 |
+
color: #374151 !important;
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
+
/* Fix específico para links en el footer */
|
| 761 |
+
footer a, .footer a, [class*="footer"] a {
|
| 762 |
+
color: #3b82f6 !important;
|
| 763 |
+
}
|
| 764 |
"""
|
| 765 |
|
| 766 |
with gr.Blocks(
|
|
|
|
| 853 |
understanding and applies research-validated Flux rules with supreme intelligence.
|
| 854 |
|
| 855 |
**🔬 Pariente AI Research Laboratory** • **🚀 Ultra Supreme Intelligence Engine**
|
| 856 |
+
""", elem_classes=["footer-content"])
|
| 857 |
|
| 858 |
return interface
|
| 859 |
|