查询模特类型模版接口
1. 接口地址
https://hidreamai.com/api-pub/ec/v3/template/model/human
2. 请求方式
GET
3. 请求参数
Header
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
Authorization | string | 是 | 客户授权Token |
Query Params
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
page_size | int | 否 | 数据分页参数,每页最大数据量,默认20, 最大100 |
page_index | int | 否 | 数据分页参数, 当前页数, 默认1 |
curl示例
curl -H 'Authorization: Bearer {USER_Authorization}' -X GET
-v 'https://hidreamai.com/api-pub/ec/v3/template/model/human'
Python示例
import pprint
import requests
import uuid
USER_Authorization = <token>
# 请求头
headers = {
'Authorization': f'Bearer {USER_Authorization}'
}
# 请求参数
params = {
"page_size": 50,
"page_index": 1
}
# 发送GET请求
url = 'https://hidreamai.com/api-pub/ec/v3/template/model/human'
response = requests.get(url, headers=headers, params=params)
# 处理响应
if response.status_code == 200:
if response.json()['code'] == 0:
results = response.json()['result']
pprint.pprint(results['templates'], indent=4)
print(f"total count is: {results['total_count']}")
else:
print(response.json()['code'], response.json()['message'])
else:
print(response.status_code)
4. 返回参数
参数 | 类型 | 说明 |
---|---|---|
code | int | 返回状态码 |
message | string | 返回状态信息 |
request_id | string | 本次请求的ID |
result | dict | 返回结果 |
其中返回结果 result
字段具体为:
参数 | 类型 | 说明 |
---|---|---|
templates | list | 模版信息列表 |
total_count | int | 模版总数量 |
total_page | int | 按当前分页后的总页数 |
其中templates
字段具体为
参数 | 类型 | 说明 |
---|---|---|
name_zh | string | 中文名称 |
name_en | string | 英文名称 |
gender | string | 模特性别, Woman, Man |
id | str | 模版ID,发送生图任务时使用 |
show_image | float | 模版封面图url。注:可在地址后拼接参数?width=512获取特定大小的图 |
age | string | 模特年龄范围。0-9、10-19、20-29、30-39、40-49、50-59、60+ |
race | string | 模特人种 |
style | string | 风格 |
template_type | string | 模版类型。 0: 通用模特模版,指通过prompt生成的人物, 体现prompt特征; 1: 固定模特模版,以某个人物作为模版 |
示例:
{
"code": 0,
"message": "Success",
"request_id": "c0e6bfde-7c8d-44b2-9ef4-7c7ac4e4390d",
"result": {
"page_index": 1,
"page_size": 2,
"templates": [
{
"age": "10-19",
"gender": "Woman",
"id": "81be52f1-6239-4181-86b2-efe096da7604",
"name_en": "name",
"name_zh": "中文名称",
"race": "latino hispanic",
"show_image": "https://storage.hidreamai.com/image/p_da46a148-4de0-4807-98cb-f31054ff799a.jpg",
"style": "Professional",
"template_type": 1
},
{
"age": "",
"gender": "Woman",
"id": "d45c0deb-4c2e-4d41-b994-e78f120c1230",
"name_en": "Black Mature Woman",
"name_zh": "非裔成熟女",
"race": "",
"show_image": "https://storage.hidreamai.com/image/p_d086b14a-a066-4896-9c19-67400f6d91c8.jpg",
"style": "",
"template_type": 0
}
],
"total_count": 46,
"total_page": 23
}
}
附
模特人种中英文对照
[
{
"name_zh": "亚洲人",
"name_en": "asian"
},
{
"name_zh": "黑人",
"name_en": "black"
},
{
"name_zh": "白人",
"name_en": "white"
},
{
"name_zh": "拉美人",
"name_en": "latino hispanic"
}
]
风格关键字中英文对照
[
{
"name_zh": "萝莉",
"name_en": "Lolita"
},
{
"name_zh": "御姐",
"name_en": "Mature woman"
},
{
"name_zh": "甜美",
"name_en": "Sweet"
},
{
"name_zh": "优雅",
"name_en": "Elegant"
},
{
"name_zh": "自然",
"name_en": "Natural"
},
{
"name_zh": "韩系",
"name_en": "Korean style"
},
{
"name_zh": "日系",
"name_en": "Japanese style"
},
{
"name_zh": "职场",
"name_en": "Professional"
},
{
"name_zh": "阳光",
"name_en": "Sunshine"
}
]