ai_qc/backend/visual_qc_apps/video_text_legibility/app.py
nickviljoen 20259dcad0 Add Honda client, video QC, session refresh, Amazon check tuning
- Add Honda client with static_general and video_general profiles
- Add video QC capability using Gemini native video analysis (4 checks:
  visual_quality, brand_consistency, text_legibility, pacing_flow)
- Add video_general profile assigned to all 8 clients
- Extend session lifetime with MSAL silent token refresh (proactive
  every 45min + reactive on expiry), switch cache to localStorage
- Re-enable OCR layout measurements for Amazon checks
- Add scope boundary notes to all 6 Amazon checks to prevent cross-
  check penalization (locale errors isolated to logo_country only)
- Relax margins left-alignment tolerance from 1% to 4% to account
  for logo lockup internal padding
- Update brand guidelines DB with Amazon localization matrix and
  processed Dove PDF summary

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 14:53:52 +02:00

103 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 VideoTextLegibilityApp(FlaskAppTemplate):
"""
Video QC - Text & Subtitle Legibility Check
Evaluates all on-screen text for readability, timing, and accessibility.
"""
def __init__(self):
prompt = """You are performing a text legibility quality-control check on a VIDEO marketing asset. You are watching the full video — evaluate ALL on-screen text throughout the entire duration.
VIDEO TEXT LEGIBILITY EVALUATION:
Evaluate the following for every text element that appears in the video:
1. TEXT READABILITY:
- Is all on-screen text large enough to read comfortably?
- Is there sufficient contrast between text and background?
- Are text elements given enough screen time to be fully read?
- Rule of thumb: viewers need approximately 1 second per 3 words to comfortably read text
2. TEXT CONTENT ACCURACY:
- Are there any visible spelling mistakes or typos in on-screen text?
- Are dates, prices, URLs, or other factual information formatted correctly?
- Is the language consistent throughout (no unexpected language switches)?
- Are any words truncated or cut off by the frame edges?
3. SUBTITLE / CAPTION ASSESSMENT (if present):
- Are subtitles/captions timed correctly with the spoken content?
- Are subtitles readable against the video background?
- Is the subtitle font size appropriate?
- Are subtitles positioned so they don't obscure important visual content?
4. LEGAL / DISCLAIMER TEXT:
- If legal text or disclaimers are present, are they readable?
- Is the legal text displayed for an adequate duration?
- Note: Legal text is often intentionally small, but must still be technically readable
5. CALL-TO-ACTION (CTA) TEXT:
- If a CTA is present (URL, "Shop Now", "Learn More", etc.), is it clearly visible?
- Is the CTA displayed long enough for viewers to act on it?
- Is the CTA positioned prominently?
STEPS TO EVALUATE:
1. Watch the full video and note every text element that appears on screen
2. For each text element, assess readability (size, contrast, duration)
3. Check for any spelling errors, typos, or formatting issues
4. Evaluate subtitle timing and readability if present
5. Check legal text and CTA visibility
6. Note any text that is truncated, obscured, or appears too briefly
DECISION CRITERIA:
- PASS (score 7-10): All text is readable, correctly spelled, displayed long enough, and has good contrast
- MODERATE ISSUES (score 4-6): Minor readability issues — slightly small text, brief display duration, or minor contrast issues
- FAIL (score 1-3): Significant text issues — unreadable text, spelling errors, text too brief to read, or poor contrast making text invisible
YOUR OUTPUT:
Format your response as JSON:
{
"text_legibility_check": "Pass" or "Fail",
"text_elements_found": ["List of text elements observed in the video"],
"readability": {
"overall": "Good" or "Moderate" or "Poor",
"contrast_issues": ["List any text with poor contrast, or empty array"],
"too_brief": ["List any text that appears too briefly to read, or empty array"],
"too_small": ["List any text that appears too small, or empty array"]
},
"content_accuracy": {
"spelling_errors": ["List any spelling/typo issues found, or empty array"],
"formatting_issues": ["List any formatting problems, or empty array"],
"language_consistency": true or false
},
"subtitles": {
"present": true or false,
"timing_sync": "Good" or "Slightly off" or "Poor" or "N/A",
"readable": true or false or "N/A"
},
"legal_text": {
"present": true or false,
"readable": true or false or "N/A",
"adequate_duration": true or false or "N/A"
},
"cta": {
"present": true or false,
"visible": true or false or "N/A",
"adequate_duration": true or false or "N/A"
},
"explanation": "Detailed reasoning for the overall assessment",
"recommendations": ["List specific recommendations if applicable, else an empty array"]
}"""
super().__init__(__name__, prompt)
# Run the app if executed directly
if __name__ == "__main__":
app_instance = VideoTextLegibilityApp()
app_instance.run()