Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Moderation (Text)

Updated on 2022-12-05 GMT+08:00

This section provides an example of how to use Postman to call Moderation (Text), helping you quickly get familiar with the service. The procedure is as follows:

Step 1: Subscribe to a Service: Subscribe to Moderation (Text) on the Content Moderation console.

Step 2: Configure a Custom Dictionary. Configure allowlist and blocklist dictionaries.

Step 3: Configure the Environment. Import the prepared configuration file into the development environment.

Step 4: Use a Token for Authentication. When you call an API, a token is required for authentication.

Step 5: Call a Service API. Call the service API. You can view the status code and error code at any time during the usage.

(Optional) Step 6: View the Number of API Calls. View call statistics and call details.

Step 1: Subscribe to a Service

Subscribe to Moderation (Text) by following the instructions in Subscribing to the Service.

Step 2: Configure a Custom Dictionary

You can configure allowlist and blocklist dictionaries for text moderation.

  • If an allowlist dictionary is customized, the words in the allowlist dictionary will not be detected when you use text moderation.

    The procedure is as follows:

    1. Log in to the HUAWEI CLOUD and click Console in the upper right corner. The Console page is displayed.
    2. Click Service List and choose AI > Content Moderation. The Content Moderation management console is displayed.
    3. In the left navigation pane, choose Service List > Text Moderation. Click Configuration next to Custom Allowlist Dictionary. The Create Dictionary dialog box is displayed.
      Figure 1 Create Dictionary
    4. Enter a dictionary name and the keywords in the allowlist dictionary. Click OK.
      • Dictionary Name: A dictionary name contains a maximum of 40 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.
      • Add Keyword: A dictionary contains a maximum of 5000 keywords. Each keyword consists of a maximum of 40 characters and ends with a carriage return.
  • If a blocklist dictionary is customized, the words in the blocklist dictionary will be detected when you use Text Moderation.

    The procedure is as follows:

    1. Log in to the HUAWEI CLOUD and click Console in the upper right corner. The Console page is displayed.
    2. Click Service List and choose AI > Content Moderation. The Content Moderation management console is displayed.
    3. In the left navigation pane, choose Service List > Text Moderation. Click Configuration next to Custom Blocklist Dictionary. The Custom Dictionary page is displayed.
    4. Click Create Dictionary in the upper left corner. The Create Dictionary dialog box is displayed. Enter a dictionary name and the keywords in the blocklist dictionary.
      1. Dictionary Name: A dictionary name contains a maximum of 40 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.
      2. Add Keyword: A dictionary contains a maximum of 5000 keywords. Each keyword consists of a maximum of 40 characters and ends with a carriage return.
    5. Click OK.
      NOTE:
      • The dictionary name cannot be modified.

Step 3: Configure the Environment

  1. Download and install Postman.

    Postman 7.24.0 is recommended.

  2. Download the Postman.
  3. Import the configuration file.
    1. Open and log in to Postman.
    2. Choose File > Import in the upper left corner. In the displayed dialog, click Upload Files to import the configuration file.
      Figure 2 Importing the configuration file
  4. After the configuration file is imported, it is displayed in the Collections directory in the left navigation pane.
    Figure 3 Configuration Files

Step 4: Use a Token for Authentication

A token is a user's access credential, which includes user identities and permissions. When you call an API to access a cloud service, a token is required for identity authentication.

  1. In the Collections directory in the navigation pane of Postman, click the get-token configuration file.
  2. Click Body. Enter the username, password, and domain name.
    NOTE:

    To obtain the username, password, and domain name, perform the following steps:

    1. Log in to the management console.
    2. Hover the cursor on the username and choose My Credentials from the drop-down list. Copy the IAM username and account name to username and domainname, and enter the IAM user password.
    Figure 4 Token-based authentication
  3. Click Send to send a request, and obtain and copy the token.

    In Headers, obtain the value of X-Subject-Token, which is the token. The token is valid for 24 hours.

    Figure 5 Obtaining a token

Step 5: Call a Service API

  1. In the Collections directory in the navigation pane of Postman, click the Moderation_image configuration file.
  2. Click Headers and copy the token value to X-Auth-Token.
    Figure 6 Entering the token
  3. Click Body and enter the text to be checked for the text parameter.
    • For details about other parameters in the body, see the Text Moderation API.
      Figure 7 Modifying the parameters
  4. Click Send to send the request and obtain the API call results.
    {
        "result": {
            "detail": {},
            "suggestion": "pass"
        }
    }

(Optional) Step 6: View the Number of API Calls

  1. View the number of API calls. Choose Service List > Text Moderation, and view call statistics and call details. See Figure 8.

    Figure 8 Call statistics
    • The Call Statistics section provides three statistical charts, displaying daily calls, daily blocked text, and daily reviewed text. You can set a time range to view the change of the number of API calls within the time range.
    • The Call Details section lists the total number of calls, blocks, reviews, and passes every day. This helps you better understand service calls and their statuses.
      NOTE:
      • block indicates that sensitive information is contained and the information is blocked.
      • pass indicates that sensitive information is not contained and the information is approved.
      • review indicates that manual review is required.

  2. View monitoring metrics. You can click View Metric to view historical data such as successful and failed calls on the Cloud Eye console. See Figure 9.

    Figure 9 Viewing metrics

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback