语音人工审核

本文介绍如何使用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

# 注意:此处实例化的client尽可能重复使用,提升检测性能。避免重复建立连接。
# 常见获取环境变量方式:
# 获取RAM用户AccessKey ID:os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID']
# 获取RAM用户AccessKey Secret:os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET']
clt = client.AcsClient("建议从环境变量中获取RAM用户AccessKey ID", "建议从环境变量中获取RAM用户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

# 注意:此处实例化的client尽可能重复使用,提升检测性能。避免重复建立连接。
# 常见获取环境变量方式:
# 获取RAM用户AccessKey ID:os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID']
# 获取RAM用户AccessKey Secret:os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET']
clt = client.AcsClient("建议从环境变量中获取RAM用户AccessKey ID", "建议从环境变量中获取RAM用户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__()