productAI

Languages

Supported Languages

ProductAI currently supports two languages: English (“en-US”) and Simplified Chinese (“zh-Hans”). Note that the default language is English. When a request is set with a specific language, the API returns the results in the requested language. For example:

  • Set “en-US” as the request language, then the API returns types in English:
{
"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"
}
  • Set “zh-Hans” as the request language, then the API returns types in Simplified Chinese:
{
"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"
}

API

Set Accept-Language in the HTTP header when the request is submitted.

Header FieldImpact
Accept-Language: zh-HansAPI returns Simplified Chinese results
Accept-Language: en-USAPI returns English results

Note: The default value is 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);