Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@directus-labs/ai-image-moderation-operation

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@directus-labs/ai-image-moderation-operation

Use Clarifai's Moderation Recognition Model to analyze image safety.

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
60
increased by5900%
Maintainers
0
Weekly downloads
 
Created
Source

AI Image Moderation Operation

Analyze images for drugs, suggestive or explicit material, powered by Clarifai.

The AI Image Moderation operation, showing a Clarifai API Token field, File URL, and threshold

This operation contains four configuration options - a Clarifai API Key, a link to a file, and a threshold percentage for the concepts to be 'flagged'. It returns a JSON object containing a score for each concept, and an array of which concepts are over the threshold.

The output showing a JSON object containing a list of conecpts with values, and an array of flagged concepts.

Output

This operation outputs a JSON object with the following structure:

{
  "concepts": [
    {
      "name": "drug",
      "value": "99.99"
    },
    {
      "name": "suggestive",
      "value": "0.00"
    },
    {
      "name": "gore",
      "value": "0.00"
    },
    {
      "name": "explicit",
      "value": "0.00"
    }
  ],
  "flags": [
    "drug"
  ]
}

Flow Setup

Automatically Moderate New Files

Create a Flow with an Event Hook action trigger and a scope of files.upload. Use the AI Image Moderation operation, setting the File URL to https://your-directus-project-url/assets/{{ $trigger.key }}, being sure to provide your specific Directus Project URL.

This will work if your file is public, but if it isn't, you can append ?access_token=token to the File URL, replacing the value with a valid user token that has access to the file.

This operation will trigger on every new file upload, regardless of location or filetype. You may wish to add a conditional step between the trigger and moderation operation. The following condition rule will check that the file is an image:

{
    "$trigger": {
        "payload": {
            "type": {
                "_contains": "image"
            }
        }
    }
}

Keywords

FAQs

Package last updated on 18 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc