Moderation (Image)
This section provides an example of how to use Postman to call Moderation (Image), helping you quickly get familiar with the service. The procedure is as follows:
Step 1: Subscribe to a Service. In the left navigation pane, choose Service List or Service Management, and subscribe to Moderation (Image).
(Optional) Step 2: Enable Object Storage Service (OBS) Authorization. If you want to use the data stored on OBS, enable OBS authorization.
(Optional) Step 3: Configure a Moderation Rule. Detect pornographic content in different scenarios.
Step 4: Configure the Environment. Import the prepared configuration file into the development environment.
Step 5: Use a Token for Authentication. When you call an API, a token is required for authentication.
Step 6: 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 7: View the Number of API Calls. View call statistics and call details.
Step 1: Subscribe to a Service
Subscribe to Moderation (Image) by following the instructions in Subscribing to the Service.
(Optional) Step 2: Enable Object Storage Service (OBS) Authorization
If you want to use the data stored on OBS, enable OBS authorization. The procedure is as follows:
- Log in to the management console and choose Service List > Content Moderation. In the navigation pane, choose Service Management.
- Enable OBS Authorization.
- The region of OBS must be consistent with that of Content Moderation.
- OBS authorization must be performed by an account, not by an IAM user.
- Once enabled, OBS authorization cannot be disabled.
(Optional) Step 3: Configure a Moderation Rule
You can configure review rules to detect pornographic content in different scenarios. For details, see Configuring Moderation Rules.
Step 4: Configure the Environment
- Download and install Postman.
- Download the Postman.
- Import the configuration file.
- Open and log in to Postman.
- Choose File > Import in the upper left corner. In the displayed dialog, click Upload Files to import the configuration file.
Figure 1 Importing the configuration file
- After the configuration file is imported, it is displayed in the Collections directory in the left navigation pane.
Figure 2 Configuration Files
Step 5: 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.
- In the Collections directory in the navigation pane of Postman, click the get-token configuration file.
- Click Body. Enter the username, password, and domain name.
To obtain the username, password, and domain name, perform the following steps:
- Log in to the management console.
- 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 3 Token-based authentication
- 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 4 Obtaining a token
Step 6: Call a Service API
- In the Collections directory in the navigation pane of Postman, click the Moderation_image configuration file.
- Click Headers and copy the token value to X-Auth-Token.
Figure 5 Entering the token
- Click Body and enter the Base64 code of the image to image.
- For details about other parameters in the body, see the Image Moderation API.
Figure 6 Modifying the parameters
- Click Send to send the request and obtain the API call results.
{ "result": { "suggestion": "pass", "category_suggestions": { "porn": "pass" }, "detail": { "porn": [ { "confidence": 0.876, "label": "normal" }, { "confidence": 0.0338, "label": "porn" }, { "confidence": 0.0902, "label": "sexy" } ] } } }
(Optional) Step 7: View the Number of API Calls
Image Moderation analyzes and identifies sensitive content (such as pornography) in images uploaded by users and returns the result.
To call Image Moderation, perform the following steps:
- Log in to the management console and choose Service List > Content Moderation.
- View the number of API calls. Choose Figure 7.
, and view call statistics and call details. See
- 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. You can click Export to download and view the total number of API calls, helping you better understand the service calling and review status.
- Images are stored in OBS buckets. Therefore, the images that are determined as block or review images cannot be exported.
- 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.
- 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 8.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot