API端点
POST https://api.example.com/v1/face/detect
请求参数
输入包含人脸的图像URL
注意:这是一个演示界面,不会发送实际请求
代码示例
JavaScript
// 人脸检测API调用示例
fetch('https://api.example.com/v1/face/detect', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image_url: 'https://example.com/images/photo.jpg',
return_attributes: ['age', 'gender', 'emotion']
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
响应结果
响应状态:200 OK耗时: 352ms
{ "request_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "time_used": 352, "faces": [ { "face_token": "e92c03f7-5a9a-4d70-8f3f-8d5c84d93a5a", "face_rectangle": { "top": 128, "left": 145, "width": 176, "height": 176 }, "attributes": { "age": { "value": 28 }, "gender": { "value": "Male" }, "emotion": { "value": "Happiness", "confidence": 95.34 } } } ] }
可视化结果
图像预览区域(演示模式)
检测结果摘要
- 检测到的人脸: 1
- 年龄: 28岁
- 性别: 男性
- 情绪: 高兴 (95.34%)