Analyses text for content that may be inappropriate for workplace environments, such as explicit language or adult themes, ensuring professionalism and compliance with workplace standards. The detector returns a binary value (0 for sfw, 1 for nsfw) indicating whether the text is not safe for work.
import requestsimport jsonimport osurl = "https://api.enkryptai.com/guardrails/detect"payload = json.dumps({ "text": "This movie scene is too explicit and contains adult dialogue that might not be suitable for all audiences.", "detectors": { "nsfw": { "enabled": True }, }})headers = { 'Content-Type': 'application/json', 'apikey': os.getenv('ENKRYPTAI_API_KEY')}response = requests.request("POST", url, headers=headers, data=payload)formatted_response = json.dumps(json.loads(response.text), indent=4)print(formatted_response)