black homelan is gone; point install+publish+auth at the live cocotte ct-forge verdaccio (:4873) / forgejo (:3000). Config-only; resolution verified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| client | ||
| service | ||
| test_images | ||
| types | ||
| app.manifest.yaml | ||
| demo_visual_output.py | ||
| README.md | ||
| README_USAGE.md | ||
| test_anime_quality.py | ||
| test_service.py | ||
| test_with_visual_review.py | ||
Imajin Semantic Validator
CLIP-based semantic attribute detection and SEO filter alignment service.
Overview
This service provides semantic validation for image generation pipelines by using CLIP models to detect attributes and validate alignment with requested SEO filters.
Port: 8005
Features
- Semantic Attribute Detection: Detect 40+ attributes (femboy, latex, anime, etc.)
- Style Classification: Classify image style (anime, photorealistic, 3d, artistic)
- Alignment Validation: Verify images match requested SEO filters
- Batch Processing: Process up to 50 images in one request
- GPU Acceleration: Auto-detects CUDA availability
API Endpoints
GET /health- Service health checkGET /info- Detector configuration and model infoGET /filters- List all available filters and stylesPOST /detect- Detect attributes in an imagePOST /align- Check alignment with requested filtersPOST /batch- Batch detection for multiple images
Installation
cd service
python -m venv .venv
source .venv/bin/activate
pip install -e .
Usage
Start Service
python -m src.api.main
Service runs on http://localhost:8005
Environment Variables
SEMANTIC_SERVICE_HOST- Host to bind (default: 0.0.0.0)SEMANTIC_SERVICE_PORT- Port to listen on (default: 8005)SEMANTIC_CLIP_MODEL- Primary CLIP model (default: openai/clip-vit-large-patch14)SEMANTIC_ATTRIBUTE_THRESHOLD- Attribute detection threshold (default: 0.25)SEMANTIC_ALIGNMENT_THRESHOLD- Alignment pass threshold (default: 0.5)
Example Request
curl -X POST http://localhost:8005/align \
-H "Content-Type: application/json" \
-d '{
"image_base64": "...",
"requested_filters": ["femboy", "latex", "anime"],
"threshold": 0.5
}'
Development
Run Tests
pytest tests/ -v
Integration Tests
pytest tests/integration/ -v --integration
Architecture
Extracted from imajin-moderator service to separate concerns:
- Moderation: Safety checks (NSFW, age, hash) - port 8001
- Semantic Validation: SEO filter alignment - port 8005
Dependencies
- FastAPI - Web framework
- CLIP (transformers) - Semantic detection
- PyTorch - Model inference
- Pillow - Image processing