Productai

语言支持

多语言结果

ProductAI的结果目前支持中文和英文。设定语言参数后,返回结果将被翻译为特定语言。例如:

  • 语言设置为zh-Hans,返回结果中type字段为中文
{
"boxes_detected": [
{
"box": [
0.2838541666666667,
0.0703125,
0.3932291666666667,
0.3958333333333333
],
"puid": "swim-suits",
"score": 0.9922139048576355,
"type": "泳装"
}
],
"detecttime": "1.138",
"image_id": "154649_262092_2185ebfc-d994-11e7-9f44-826ef5ee9c93",
"request_id": "2185ebfc-d994-11e7-9f44-826ef5ee9c93",
"time": "1.497",
"ver": "2.0.6"
}
  • 语言设置为en-US,返回结果中type字段为英文
{
"boxes_detected": [
{
"box": [
0.2838541666666667,
0.0703125,
0.3932291666666667,
0.3958333333333333
],
"puid": "swim-suits",
"score": 0.9922139048576355,
"type": "swim-suits"
}
],
"detecttime": "1.135",
"image_id": "154634_160797_2a601c3e-d994-11e7-a52c-0e9f362b9122",
"request_id": "2a601c3e-d994-11e7-a52c-0e9f362b9122",
"time": "1.543",
"ver": "2.0.6"
}

API支持

使用API调用服务时,通过设置header中的Accept-Language来进行语言切换。目前支持的语言可以为:

Header字段结果
Accept-Language: zh-Hans所有的结果以简体中文返回
Accept-Language: en-US所有的结果以英文返回

注:默认使用en-US。

SDK支持

Python

PHP

Java

C#

from productai import Client

cli = Client(ACCESS_KEY_ID, SECRET_KEY)
cli.set_lang('zh-Hans')
use ProductAI;

$product_ai = new ProductAI\API(ACCESS_KEY_ID, SECRET_KEY, 'zh-Hans');
IProfile profile = new DefaultProfile();
profile.setAccessKeyId(ACCESS_KEY_ID);
profile.setSecretKey(SECRET_KEY);
profile.setVersion("1");
profile.setGlobalLanguage(LanguageType.Chinese);

IWebClient client = new DefaultProductAIClient(profile);
IProfile profile = new DefaultProfile
{
Version = "1",
AccessKeyId = ACCESS_KEY_ID,
SecretKey = SECRET_KEY,
GlobalLanguage = LanguageType.Chinese
};

var client = new DefaultProductAIClient(profile);