## New Features ### L'Oréal Static General Profile - Created new profile with 3 checks optimized for digital marketing assets - Even weighting (33.3% each) for 100-point scoring scale - Removed print-specific requirements (3m viewing distance) - Focus on marketing text vs product packaging distinction ### Multi-File Queue System (web_ui.html) - Added file queue functionality for batch processing - Users can now upload and process multiple files simultaneously - Queue displays file status (pending, analyzing, complete, error) - Individual file removal and queue clearing options - Progress tracking for batch operations ### New General QC Checks 1. background_contrast_general - Optimized for digital assets (no distance requirements) - Checks logo, product, and marketing text contrast - Detects overlapping and blending issues - Provides element-by-element breakdown 2. text_readability_general - Focus on marketing text only (excludes product packaging) - Checks for overlapping elements - Digital readability optimization - Specific issue identification 3. language_consistency (enhanced) - Better distinction between marketing and packaging text - Detailed language detection and reporting - Lists specific text analyzed ### Usage Tracking System - Added usage_tracker.py for analysis logging - Tracks user activity, profile usage, and costs - Daily log files in JSONL format - Cost estimation per LLM provider ## Bug Fixes ### Authentication & User Management - Fixed Flask 'g' import missing issue - Fixed user info access in background threads - Pass user_info to threads instead of accessing g.user - Improved error handling for usage logging ### HTML Report Generation - Fixed missing analysis details in reports - Now extracts and displays all JSON fields properly - Shows comprehensive breakdowns: - Analysis details - Elements checked (logo, product, text) - Marketing text found - Issues identified - Specific recommendations - No more blank "Pass/Fail" results ### Scoring System - Fixed usage_tracker to handle dict of check results (not list) - Better handling of model_used field variations - Skip non-dict check results gracefully ## Configuration Changes ### Model Versions (llm_config.py) - Fixed invalid GPT-4.1 model ID to gpt-4o - Added Gemini 3 Pro beta model option - AVAILABLE_MODELS dict for UI selection - Model version override support ### Profile Updates - Static General: 3 checks, total weight 10.0 - Each check: text_readability_general (3.33), background_contrast_general (3.33), language_consistency (3.34) - Maximum score: 100 points ## Technical Improvements - Enhanced prompt engineering for consistent LLM outputs - Mandatory detailed explanations in all checks - Structured JSON responses with comprehensive fields - Better error messages and fallback handling - Client configuration support (client_config.py) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
86 lines
4.3 KiB
Python
86 lines
4.3 KiB
Python
import os
|
|
import sys
|
|
|
|
# Add parent directory to path to import shared modules
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
|
|
|
from visual_qc_apps.flask_app_template import FlaskAppTemplate
|
|
|
|
class LanguageConsistencyApp(FlaskAppTemplate):
|
|
"""
|
|
Language Consistency Check - Detects mixed languages in marketing materials
|
|
"""
|
|
|
|
def __init__(self):
|
|
# Define the hardcoded prompt
|
|
prompt = """You are performing a visual quality control check on a marketing material or advertisement. Your task is to verify that all MARKETING TEXT uses a single, consistent language throughout the creative.
|
|
|
|
CRITICAL: Focus on MARKETING/ADVERTISING TEXT (headlines, slogans, body copy). Text on product packaging, labels, or bottles shown in product photography is NOT evaluated - this is part of the product itself and may naturally be in different languages.
|
|
|
|
EVALUATION STEPS:
|
|
|
|
1. Identify all readable MARKETING text in the image:
|
|
a. Headlines and main copy
|
|
b. Body text and descriptions
|
|
c. Call-to-action text
|
|
d. Promotional messaging
|
|
e. Slogans and taglines
|
|
(EXCLUDE: Brand names, product names, legal disclaimers, trademarked terms, AND text on product packaging/labels)
|
|
|
|
2. Analyze the language of each marketing text element:
|
|
a. Identify the primary language used in the marketing message
|
|
b. Check for any marketing text elements in different languages
|
|
c. Pay special attention to:
|
|
- Mixed language headings (e.g., German header with English subtext)
|
|
- Overlapping text in multiple languages
|
|
- Language switches within the same sentence or paragraph in marketing copy
|
|
d. IGNORE: Text printed on product packaging, bottles, or labels (this is part of the product photography)
|
|
|
|
3. Determine language consistency:
|
|
a. "PASS" if all MARKETING text uses a single language consistently
|
|
b. "FAIL" if multiple languages are detected in the MARKETING/ADVERTISING copy
|
|
c. If there is NO marketing text (only product photography with packaging text), state "No marketing text found"
|
|
|
|
4. Special cases to EXCLUDE from evaluation:
|
|
a. Brand names and product names (e.g., "L'Oréal", "Schwarzkopf")
|
|
b. Legal text and disclaimers
|
|
c. Trademarked terms
|
|
d. Text on product packaging, bottles, or labels visible in product photos
|
|
e. Regional variations of the same language (e.g., US English vs UK English) count as consistent
|
|
|
|
DECISION CRITERIA:
|
|
• Pass: All user-facing MARKETING text is in one language (excluding brand names, legal text, and product packaging text)
|
|
• Fail: Two or more languages are mixed in headlines, body copy, or key marketing messaging
|
|
• The goal is to ensure market-appropriate, single-language marketing messages for each region
|
|
|
|
YOUR OUTPUT MUST INCLUDE:
|
|
• Detailed explanation of what marketing text was found and analyzed
|
|
• Clear identification of which languages were detected WHERE
|
|
• Distinction between marketing text and product packaging text
|
|
• Specific examples of mixed language if found
|
|
|
|
Format your response as JSON:
|
|
{
|
|
"language_consistency": "Pass" or "Fail",
|
|
"primary_language": "Name of primary language used in marketing text",
|
|
"languages_detected": ["Language 1", "Language 2", ...],
|
|
"analysis_details": "Detailed explanation: What marketing text was checked, what languages were found, and where they appear. If no marketing text exists, state that clearly.",
|
|
"marketing_text_found": ["List the actual marketing text you analyzed, e.g., 'Headline: Get Soft Hair', 'CTA: Buy Now'"],
|
|
"mixed_language_locations": ["Specific locations where different languages appear, e.g., 'Headline in German, body text in English'"] (only if multiple languages),
|
|
"recommendation": "Brief recommendation if failed, or 'None' if passed"
|
|
}
|
|
|
|
CRITICAL:
|
|
1. Always provide detailed analysis_details explaining what was checked and found
|
|
2. Focus ONLY on marketing text, NOT product packaging text
|
|
3. List specific examples of the marketing text you analyzed
|
|
4. If no marketing text exists in the image, clearly state this
|
|
5. Never return just "Pass" or "Fail" without comprehensive explanation"""
|
|
|
|
# Initialize the Flask app with the prompt
|
|
super().__init__(__name__, prompt)
|
|
|
|
# Run the app if executed directly
|
|
if __name__ == "__main__":
|
|
app_instance = LanguageConsistencyApp()
|
|
app_instance.run()
|