ai_qc/backend/visual_qc_apps/inclusive/app.py
nickviljoen 3fec052c12 Create frontend and backend folder structure for deployment
Organized the application into separate frontend and backend directories for cleaner deployment and better separation of concerns.

Frontend Directory (frontend/):
- index.html: Single-page web interface (renamed from web_ui.html)
- README.md: Frontend deployment guide
- Total size: ~113 KB (self-contained)
- Smart base path detection (works at / or /ai_qc/)
- No configuration changes required

Backend Directory (backend/):
- All Python files (api_server.py, llm_config.py, etc.)
- visual_qc_apps/: 33 QC check modules
- profiles/: 6 QC profile configurations
- brand_guidelines/: Reference asset storage
- config/: Environment configurations
- scripts/: Deployment automation
- uploads/, output/: Data directories
- requirements.txt, ai_qc.service, apache_config.conf
- Complete documentation

New Documentation:
- FOLDER_STRUCTURE.md: Comprehensive guide to new structure
- frontend/README.md: Frontend deployment instructions
- backend/BACKEND_README.md: Backend deployment guide

Deployment Mapping:
- frontend/ → /var/www/html/ai_qc/ (web root)
- backend/ → /opt/ai_qc/ (application directory)

Benefits:
- Clear separation of concerns
- Backend code not in web-accessible directory
- Independent frontend/backend updates
- Matches server's existing patterns (/opt/veo3, /opt/voice2text)
- Industry-standard architecture
- Easy to deploy and maintain

Original files preserved in root directory for reference.
Ready for production deployment following MIGRATION_GUIDE.md.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 11:55:53 +02:00

86 lines
No EOL
3.8 KiB
Python
Executable file

import os
import sys
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 InclusiveApp(FlaskAppTemplate):
"""
Inclusive Representation QC Tool - Evaluates content using the Unstereotype 3Ps Framework
Analyzes Presence, Perspective, and Personality for inclusive representation
"""
def __init__(self):
prompt = """
You are a visual quality control expert specializing in inclusive representation analysis using the Unstereotype 3Ps Framework. Your task is to evaluate this image for inclusive representation across three key dimensions: Presence, Perspective, and Personality.
EVALUATION FRAMEWORK - The Unstereotype 3Ps:
1. PRESENCE - Equal and Authentic Representation:
- Assess representation across gender, race, ethnicity, age, ability, sexual orientation
- Evaluate balance of screen time and visibility for different groups
- Check if diverse people are shown in varied roles (workplace, home, leadership)
- Examine representation in both primary and background roles
- Consider intersectionality - multiple identity aspects working together
- Look for tokenism vs. meaningful inclusion
2. PERSPECTIVE - Diverse Viewpoints and Agency:
- Evaluate if diverse viewpoints and cultural experiences are shown
- Check for stereotypical storylines and narratives
- Assess if people are portrayed as empowered agents vs. passive subjects
- Examine agency and decision-making representation
- Evaluate if traditional power dynamics are challenged appropriately
- Analyze camera angles and framing for objectification or diminishment
3. PERSONALITY - Multi-dimensional Characterization:
- Assess if characters are portrayed as full, complex individuals
- Check for avoidance of one-dimensional stereotypical traits
- Evaluate realistic emotions, motivations, and behaviors
- Examine representation of human experience complexity
- Assess authenticity vs. tokenistic characterization
- Look for depth beyond surface-level diversity
EVALUATION PROCESS:
1. Carefully examine all people visible in the image
2. Identify the context, setting, and apparent narrative
3. Analyze each of the 3Ps dimensions systematically
4. Consider both what is shown and what might be missing
5. Evaluate the overall inclusive representation quality
SCORING METHODOLOGY:
For each of the 3Ps, provide a score from 1-5:
1. PRESENCE - Equal and Authentic Representation (1-5)
2. PERSPECTIVE - Diverse Viewpoints and Agency (1-5)
3. PERSONALITY - Multi-dimensional Characterization (1-5)
INDIVIDUAL P SCORING (1-5):
- 5: Exemplary implementation with outstanding inclusive representation
- 4: Strong implementation with minor areas for improvement
- 3: Adequate implementation meeting basic inclusive standards
- 2: Limited implementation with significant representation issues
- 1: Poor implementation with harmful stereotypes or exclusion
- N/A: Not applicable/no people or relevant content to evaluate
OVERALL SCORING (1-10):
Calculate overall score from the average of applicable P scores, scaled to 1-10.
If any P is not applicable (e.g., no people visible, no narrative context), exclude it from scoring.
Provide your analysis in JSON format with:
- Individual scores for each of the 3Ps (1-5 or "N/A")
- Overall inclusive representation score (1-10) calculated from applicable Ps
- Detailed assessment explaining each P score
- List of which Ps were excluded and why
- Specific observations about representation
- Recommendations for improvement
- Potential concerns or red flags
Be thorough, constructive, and sensitive in your evaluation while maintaining professional objectivity.
"""
super().__init__(__name__, prompt)
if __name__ == "__main__":
app = InclusiveApp()
app.run(debug=True)