How to use @azure/cognitiveservices-contentmoderator - 2 common examples

To help you get started, we’ve selected a few @azure/cognitiveservices-contentmoderator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure-Samples / cognitive-services-quickstart-code / javascript / ContentModerator / content_moderator_quickstart.js View on Github external
*/
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentials = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_SUBSCRIPTION_KEY'] } });
let client = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentials);
/**
 * END - Authenticate
 */

/**
* AUTHENTICATE - HUMAN REVIEWS
* To create a human review, a special client is needed due to a unique subscription key.
* Get the key from the Content Moderator website: go to the gear symbol (settings) --> Credentials --> Ocp-Apim-Subscription-Key
*/
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentialsReviews = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_REVIEWS_KEY'] } });
let clientReviews = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentialsReviews);
/**
* END - Authenticate Human Reviews
*/

async function main() {

    console.log('\n##############################################################################\n')

    /**
     * IMAGE MODERATION
     * This example will moderate URL images.
     */
    console.log('IMAGE MODERATION')
    console.log()

    // Moderate racy content
github Azure-Samples / cognitive-services-quickstart-code / javascript / ContentModerator / content_moderator_quickstart.js View on Github external
// Human Reviews - Images variables
// Set your callback endpoint in your environment variables with your own region. 
// For example: 'https://westus.api.cognitive.microsoft.com/contentmoderator/review/v1.0'.
let callbackEndpoint = process.env['CONTENT_MODERATOR_REVIEWS_ENDPOINT']
// The team name you used when you created an account at the Content Moderator website
const TEAM_NAME = process.env['CONTENT_MODERATOR_TEAM_NAME']
// Time to wait for processing the review (in milliseconds)
const TIME_TO_SLEEP = 45000;

/**
 * AUTHENTICATE
 * Using your subscription key and endpoint, a client is created that is used call the API.
 */
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentials = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_SUBSCRIPTION_KEY'] } });
let client = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentials);
/**
 * END - Authenticate
 */

/**
* AUTHENTICATE - HUMAN REVIEWS
* To create a human review, a special client is needed due to a unique subscription key.
* Get the key from the Content Moderator website: go to the gear symbol (settings) --> Credentials --> Ocp-Apim-Subscription-Key
*/
// Set CONTENT_MODERATOR_SUBSCRIPTION_KEY and CONTENT_MODERATOR_ENDPOINT in your environment variables.
let credentialsReviews = new auth.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': process.env['CONTENT_MODERATOR_REVIEWS_KEY'] } });
let clientReviews = new ContentModerator.ContentModeratorClient(process.env['CONTENT_MODERATOR_ENDPOINT'], credentialsReviews);
/**
* END - Authenticate Human Reviews
*/

@azure/cognitiveservices-contentmoderator

ContentModeratorClient Library with typescript type definitions for node.js and browser.

MIT
Latest version published 4 years ago

Package Health Score

73 / 100
Full package analysis

Popular @azure/cognitiveservices-contentmoderator functions