AI识图
# 接口信息
- 接口状态 : 正常
- 请求方式 :
POST - 返回格式 :
JSON - 扣除积分数 :
10
# 请求地址
http://api-gateway.tempeisite.xyz/api/ai/imageRecognition
1
# 请求参数
| 参数名 | 必选 | 类型 | 描述 |
|---|---|---|---|
| imageURL | 是 | String | 图片url地址 |
# 响应参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | int | 响应码 |
| data | string | 响应结果,见示例 |
| message | string | 响应描述 |
# 代码示例
注意 🔔️
没有开发者调用凭证无法调用接口哦!!! 前往获取开发者凭证 (opens new window)
注入Service
@Resource
private ApiClient apiClient;
1
2
2
- 示例一 :推荐👍
通过yml配置开发者调用凭证
@org.junit.jupiter.api.Test
public void imageRecognition1() {
String imageUrl = "https://sfile.chatglm.cn/testpath/275ae5b6-5390-51ca-a81a-60332d1a7cac_0.png";
String result = apiClient.imageRecognition(imageUrl);
System.out.println(result);
}
1
2
3
4
5
6
2
3
4
5
6
响应示例:
{
"code": 200,
"data": {
"choices": [
{
"finishReason": "stop",
"index": 0,
"message": {
"content": "图中是一只小狗,它的毛发是棕色和白色的,嘴巴张开,露出粉色的舌头和牙齿。图片的左下角有2支铅笔。图片右下角有一个水印,写着“AI生成”。",
"role": "assistant"
}
}
],
"created": 1715167169,
"id": "8635234436820866838",
"model": "glm-4v",
"usage": {
"completionTokens": 52,
"promptTokens": 1671,
"totalTokens": 1723
}
},
"msg": "调用成功",
"success": true
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 示例二:
@org.junit.jupiter.api.Test
public void imageRecognition2() {
ApiClient apiClient = new ApiClient("1e4cd3ef6a8d2538044a027c07508488", "af5a11324adf26ae19d79a88b8e6cd08");
String imageUrl = "https://sfile.chatglm.cn/testpath/275ae5b6-5390-51ca-a81a-60332d1a7cac_0.png";
String result = apiClient.imageRecognition(imageUrl);
System.out.println(result);
}
1
2
3
4
5
6
7
2
3
4
5
6
7
# 常见问题
识别的物体有哪些?
答:识别的内容包括动物、交通工具、生活家具等2万多种生活常见物体。
物体识别支持什么应用平台?
答:目前场景识别支持Web api应用平台。
物体识别的图片要求?
答:图片格式为.png、.jpg、.jpeg、.bmp、.tif。图片大小不超过800k。
# 更多示例详见:AI问答开放平台-SDK-Demo 示例项目 (opens new window)
上次更新: 2024/05/15, 04:33:36