Phramer_AI / analyzer.py
Malaji71's picture
Update analyzer.py
51e1993 verified
raw
history blame
2.87 kB
"""
Ultra Supreme Analyzer - VERSIÓN SIMPLIFICADA
Solo formatea, no limita
"""
import re
from typing import Dict, List, Any, Tuple
class UltraSupremeAnalyzer:
"""Analyzer simplificado que NO limita CLIP"""
def __init__(self):
pass
def ultra_supreme_analysis(self, clip_fast: str, clip_classic: str, clip_best: str) -> Dict[str, Any]:
"""Análisis mínimo - solo devuelve los datos raw"""
return {
"clip_fast": clip_fast,
"clip_classic": clip_classic,
"clip_best": clip_best,
"full_description": f"{clip_fast} {clip_classic} {clip_best}",
"demographic": {"age_category": None, "age_confidence": 0, "gender": None, "cultural_religious": []},
"facial_ultra": {"eyes": [], "eyebrows": [], "nose": [], "mouth": [], "facial_hair": [], "skin": [], "structure": []},
"emotional_state": {"primary_emotion": None, "emotion_confidence": 0, "micro_expressions": [], "overall_demeanor": []},
"clothing_accessories": {"headwear": [], "eyewear": [], "clothing": [], "accessories": []},
"environmental": {"setting_type": None, "specific_location": None, "lighting_analysis": [], "atmosphere": []},
"pose_composition": {"body_language": [], "head_position": [], "eye_contact": [], "posture": []},
"technical_analysis": {"shot_type": None, "angle": None, "lighting_setup": None, "suggested_equipment": {}},
"intelligence_metrics": {"total_features_detected": 0, "analysis_depth_score": 0, "cultural_awareness_score": 0, "technical_optimization_score": 0}
}
def build_ultra_supreme_prompt(self, ultra_analysis: Dict[str, Any], clip_results: List[str]) -> str:
"""NO construye nada - este método ya no se usa con el nuevo pipeline"""
# Este método existe solo por compatibilidad
# El verdadero trabajo se hace en optimizer.py con apply_flux_rules()
return clip_results[0] if clip_results else ""
def calculate_ultra_supreme_score(self, prompt: str, ultra_analysis: Dict[str, Any]) -> Tuple[int, Dict[str, int]]:
"""Calcula score basado en la longitud y riqueza del prompt"""
score = 0
breakdown = {}
# Simple scoring basado en características del prompt final
if len(prompt) > 50:
score += 25
breakdown["length"] = 25
if "Shot on" in prompt:
score += 25
breakdown["camera"] = 25
if "lighting" in prompt.lower():
score += 25
breakdown["lighting"] = 25
if any(word in prompt.lower() for word in ["photography", "cinematic", "professional"]):
score += 25
breakdown["style"] = 25
return min(score, 100), breakdown