本文介绍如何使用Python SDK语音人工审核接口,进行人工审核。

功能描述

如果您认为语音检测结果与您的预期不符,可以进行人工审核。关于参数的详细信息,请参见语音人工审核API文档

您需要使用内容安全的API接入地址,调用本SDK接口。关于API接入地址的信息,请参见接入地址(Endpoint)

前提条件

提交语音人工审核任务

# coding=utf-8
import uuid

from aliyunsdkcore import client
from aliyunsdkcore.profile import region_provider
from aliyunsdkgreen.request.v20180509 import VoiceAsyncManualScanRequest
import json

# 请使用您的AccessKey信息。
clt = client.AcsClient("您的AccessKey ID", "您的AccessKey Secret", 'cn-shanghai')
region_provider.modify_point('Green', 'cn-shanghai', 'green.cn-shanghai.aliyuncs.com')
request = VoiceAsyncManualScanRequest.VoiceAsyncManualScanRequest()
request.set_accept_format('JSON')

# callback、seed用于回调通知,可选参数。
request.set_content(
    json.dumps(
        {"tasks": [{"dataId": "检测数据ID", "url": "待检测音频链接"}], "callback": "回调地址",
         "seed": "随机字符串"}))

try:
    response = clt.do_action_with_exception(request)
    print response
except Exception, err:
    print err.__str__()

查询语音人工审核任务结果

# coding=utf-8

from aliyunsdkcore import client
from aliyunsdkcore.profile import region_provider
from aliyunsdkgreen.request.v20180509 import VoiceAsyncManualScanResultsRequest
import json

# 请使用您的AccessKey信息。
clt = client.AcsClient("您的AccessKey ID", "您的AccessKey Secret", 'cn-shanghai')
region_provider.modify_point('Green', 'cn-shanghai', 'green.cn-shanghai.aliyuncs.com')
request = VoiceAsyncManualScanResultsRequest.VoiceAsyncManualScanResultsRequest()
request.set_accept_format('JSON')

request.set_content(json.dumps(["语音人工审核任务ID"]))

try:
    response = clt.do_action_with_exception(request)
    print response
except Exception, err:
    print err.__str__()