Spaces:
Sleeping
Sleeping
Commit History
-
Fix AI detector stability, serialization, and test accuracy (#13)
Fixes applied: - Guard corrupted images (cv2.imdecode None check) - NaN protection in JPEG blockiness (empty list guard) - numpy.bool_ wrapped with bool() for Pydantic serialization - Dynamic FFT center_size: min(30, crow, ccol) for small images - float() on all numpy scalars in return dicts Test fixes: - Replace 1x1px fixture with 100x100px gradient + Gaussian noise - Update size_mb assertion from < 0.01 to < 1.0 Result: 25/25 tests passingd94d03c
-
Add file validation utility (#4)
- Implement MIME type validation using python-magic - Add file size limit enforcement (50MB max) - Create FileValidationError for validation failures - Add comprehensive unit tests with fixtures - Use centralized logger for validation events Security features: - Validates actual file content, not just extension - Prevents renamed malicious files (.exe -> .jpg) - Enforces memory-safe size limits Closes #4219cb99