# DEMO示例
# 服务场景描述
智能现场管理服务通过调用智能现场管理服务API完成施工现场的隐患识别,物料卡车识别,人脸识别等,图纸识别服务通过调用图纸识别服务管理API完成智能算量楼层表识别服务,智能造价AEC文本识别服务通过调用智能造价AEC文本识别服务API完成建筑行业的文本解析
# 服务调用流程
# 1.本服务调用依赖以下API:
# 2.服务调用前置条件:
创建应用,获取appkey、appsecret;
获取服务调用token;
开通服务,scope授权通过;
以上步骤可参考前置准备
# 智能现场管理服务调用示例
//创建请求
OkHttpClient client = new OkHttpClient();
String json = "{\"accessToken\":\"cn-85182098-3534-4cc9-95d2-c1f93d2738b8\",\"dataContent\":{\"dataType\":0,\"dataContent\":\"https://sjzn-autotest-data.obs.myhuaweicloud.com:443/cv/hardhat/1.jpg\",\"algorithms\":[\"hardhat\"]}}";
RequestBody body = RequestBody.create(MediaType.parse("application/json"),json);
//请求参数设置
Request request = new Request.Builder()
.url("https://apigate.glodon.com/openai/cv/aggHazardIdentification")
.post(body)
.addHeader("Authorization","bearer cn-85182098-3534-4cc9-95d2-c1f93d2738b8")
.addHeader("Content-Type","application/json")
.build();
//发送请求
Response response = client.newCall(request).execute();
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 图纸识别服务调用示例
//创建请求
OkHttpClient client = new OkHttpClient();
String json = "{\"accessToken\":\"cn-85182098-3534-4cc9-95d2-c1f93d2738b8\",\"state\":\"abc\",\"dataContent\":{\"dataContent\":\"https://sjzn-autotest-data.obs.cn-north-4.myhuaweicloud.com:443/cad/642t3.zip\"}}";
RequestBody body = RequestBody.create(MediaType.parse("application/json"),json);
//请求参数设置
Request request = new Request.Builder()
.url("https://apigate.glodon.com/openai/cad/aggCadIdentification")
.post(body)
.addHeader("Authorization","bearer cn-85182098-3534-4cc9-95d2-c1f93d2738b8")
.addHeader("Content-Type","application/json")
.build();
//发送请求
Response response = client.newCall(request).execute();
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 智能造价AEC文本识别服务
//创建请求
OkHttpClient client = new OkHttpClient();
String json = "{\"accessToken\":\"cn-85182098-3534-4cc9-95d2-c1f93d2738b8\",\"dataContent\":{\"properties\": {\"annotators\":\"tokenize,ssplit,pos,ner,depparse\",\"date\":\"2019-12-10T11:07:33\"},\"pipelineLanguage\": \"zh\",\"body\": \"快速的棕色狐狸跳过了懒惰的狗\"}}";
RequestBody body = RequestBody.create(MediaType.parse("application/json"),json);
//请求参数设置
Request request = new Request.Builder()
.url("https://apigate.glodon.com/openai/nlp/atomTextAnnotation")
.post(body)
.addHeader("Authorization","bearer cn-85182098-3534-4cc9-95d2-c1f93d2738b8")
.addHeader("Content-Type","application/json")
.build();
//发送请求
Response response = client.newCall(request).execute();
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 演示代码
public class OpenAiExample {
public static void main(String[] args) throws IOException {
OpenAiExample example = new OpenAiExample();
example.Cv();
example.Cad();
example.Aec();
}
private void Cv() throws IOException {
OkHttpClient client = new OkHttpClient();
String json = "{\"accessToken\":\"cn-85182098-3534-4cc9-95d2-c1f93d2738b8\",\"dataContent\":{\"dataType\":0,\"dataContent\":\"https://sjzn-autotest-data.obs.myhuaweicloud.com:443/cv/hardhat/1.jpg\",\"algorithms\":[\"hardhat\"]}}";
RequestBody body = RequestBody.create(MediaType.parse("application/json"),json);
Request request = new Request.Builder()
.url("https://apigate.glodon.com/openai/cv/aggHazardIdentification")
.post(body)
.addHeader("Authorization","bearer cn-85182098-3534-4cc9-95d2-c1f93d2738b8")
.addHeader("Content-Type","application/json")
.build();
Response response = client.newCall(request).execute();
}
public void Cad() throws IOException {
OkHttpClient client = new OkHttpClient();
String json = "{\"accessToken\":\"cn-85182098-3534-4cc9-95d2-c1f93d2738b8\",\"state\":\"abc\",\"dataContent\":{\"dataContent\":\"https://sjzn-autotest-data.obs.cn-north-4.myhuaweicloud.com:443/cad/642t3.zip\"}}";
RequestBody body = RequestBody.create(MediaType.parse("application/json"),json);
Request request = new Request.Builder()
.url("https://apigate.glodon.com/openai/cad/aggCadIdentification")
.post(body)
.addHeader("Authorization","bearer cn-85182098-3534-4cc9-95d2-c1f93d2738b8")
.addHeader("Content-Type","application/json")
.build();
Response response = client.newCall(request).execute();
}
public void Aec() throws IOException {
OkHttpClient client = new OkHttpClient();
String json = "{\"accessToken\":\"cn-85182098-3534-4cc9-95d2-c1f93d2738b8\",\"dataContent\":{\"properties\": {\"annotators\":\"tokenize,ssplit,pos,ner,depparse\",\"date\":\"2019-12-10T11:07:33\"},\"pipelineLanguage\": \"zh\",\"body\": \"快速的棕色狐狸跳过了懒惰的狗\"}}";
RequestBody body = RequestBody.create(MediaType.parse("application/json"),json);
Request request = new Request.Builder()
.url("https://apigate.glodon.com/openai/nlp/atomTextAnnotation")
.post(body)
.addHeader("Authorization","bearer cn-85182098-3534-4cc9-95d2-c1f93d2738b8")
.addHeader("Content-Type","application/json")
.build();
Response response = client.newCall(request).execute();
}
}
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57