获取SDK
pip install aliyun-python-sdk-core # 安装阿里云 SDK 核心库
pip install aliyun-python-sdk-nlp-automl # 安装NLP自学习平台SDK
使用示例
# -*- coding: utf8 -*- import json
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdknlp_automl.request.v20191111 import GetPredictResultRequest
# Initialize AcsClient instance
client = AcsClient(
"<your-access-id-key>",
"<your-access-id-secret>",
"cn-hangzhou"
);
# Initialize a request and set parameters
request = GetPredictResultRequest.GetPredictResultRequest()
request.set_ModelId(1818)
request.set_Content('中华人民共和国')
# Print response
response = client.do_action_with_exception(request)
resp_obj = json.loads(response)
print(resp_obj['Content'])
在文档使用中是否遇到以下问题
更多建议
匿名提交