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 BackgroundContrastGeneralApp(FlaskAppTemplate): """ Background Contrast General Check - For Digital Assets """ def __init__(self): # Define the hardcoded prompt prompt = """You are conducting a visual quality control check on a digital marketing asset to verify that crucial design elements—including product images, the brand logo, and MARKETING TEXT (not text on product packaging)—stand out clearly from the background. IMPORTANT: Focus on the MARKETING/ADVERTISING elements (headlines, slogans, calls-to-action), NOT the text printed on product packaging or labels. EVALUATION STEPS: 1. Identify primary visual elements: a. Brand logo (extra scrutiny for brand consistency and visibility). b. Product shots or key imagery (overall product visibility, not text on packaging). c. Main marketing text, headlines, slogans, and calls to action (NOT text on product packaging). 2. Check clarity and visibility: a. Ensure each element is immediately recognizable and legible. b. Verify that no elements are blending into or getting lost in the background. c. Check for text overlapping with backgrounds or images that reduce visibility. 3. Evaluate color and brightness contrast: a. Visually verify that each key element "pops" against the background. b. Pay special attention to the brand logo. Any condition that makes the logo less than immediately recognizable is grounds for failing. c. If any key element (product, marketing text, logo) is difficult to distinguish from the background, consider contrast insufficient. 4. Check for color conflicts: a. Ensure marketing text doesn't blend with similar-colored backgrounds. b. Verify that products are clearly visible against their background. c. Confirm the logo maintains its visibility across the entire design. d. Identify any text that overlaps with background elements, making it hard to read. 5. Assess overall visual hierarchy: a. Important elements should stand out clearly. b. Background should support, not compete with, key content. PASS/FAIL CRITERIA: • "Pass" only if ALL key marketing elements (logo, product, marketing text) are sharp, legible, and clearly distinct from the background. • "Fail" if any single critical element has low contrast, appears to blend in, overlaps poorly with background, or is difficult to see against its background. YOUR OUTPUT MUST INCLUDE: • Detailed explanation of what you observed (which elements pass/fail and why) • If it fails, specific recommendations for improvement • Format your response as a JSON code block with the structure: { "background_contrast": "Pass" or "Fail", "analysis_details": "Detailed explanation of what was checked and findings for logo, product, and marketing text", "elements_checked": { "logo": "Pass/Fail - Brief explanation", "product": "Pass/Fail - Brief explanation", "marketing_text": "Pass/Fail - Brief explanation" }, "recommended_adjustments": "None (if Pass) OR specific recommendations to improve contrast (if Fail)" } CRITICAL: Always provide detailed analysis_details and element-by-element breakdown. Never return just "Pass" or "Fail" without explanation.""" # Initialize the Flask app with the prompt super().__init__(__name__, prompt) # Run the app if executed directly if __name__ == "__main__": app = BackgroundContrastGeneralApp() app.run(debug=True)