{
"error": "Internal server error during NSFW detection",
"details": "Error message details"
}
Technical Details
Model: Uses nsfwjs v2.4.2 with TensorFlow.js v4.15.0
Image Processing: Uses jpeg-js library to decode JPEG images and convert to tensors for nsfwjs compatibility
Model Loading: Attempts multiple model sources for Val Town compatibility
Performance: Model is loaded once and cached for subsequent requests
Memory Management: Properly disposes tensors to prevent memory leaks
Threshold: Content is considered NSFW if any NSFW category has probability > 0.5
Deployment
This script is designed to run on Val Town. Simply upload the nsfw-detector.http.tsx file to your Val Town account and it will be available as an HTTP endpoint.
License
This project uses the nsfwjs library for content detection. Please refer to their license terms for usage restrictions.