提交 c6fc5afd authored 作者: yangqi's avatar yangqi

1

上级 bf805f19
...@@ -25,4 +25,11 @@ public class FaceController { ...@@ -25,4 +25,11 @@ public class FaceController {
List<String> list = faceService.getFaceDbList(); List<String> list = faceService.getFaceDbList();
return new ApiResponse<>(list); return new ApiResponse<>(list);
} }
@NoAuth
@GetMapping("/createFaceDb")
public ApiResponse<Object> createFaceDb(String name) throws Exception {
faceService.createFaceDb(name);
return new ApiResponse<>();
}
} }
...@@ -52,7 +52,7 @@ public class Face { ...@@ -52,7 +52,7 @@ public class Face {
* @link {https://help.aliyun.com/document_detail/159142.html} * @link {https://help.aliyun.com/document_detail/159142.html}
*/ */
public List<String> getFaceDbList() throws Exception { public List<String> getFaceDbList() throws Exception {
com.aliyun.facebody20191230.Client client = this.createClient(); com.aliyun.facebody20191230.Client client = createClient();
ListFaceDbsRequest request = new ListFaceDbsRequest(); ListFaceDbsRequest request = new ListFaceDbsRequest();
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions(); com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
...@@ -66,6 +66,19 @@ public class Face { ...@@ -66,6 +66,19 @@ public class Face {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 创建人脸库
* @link {https://help.aliyun.com/document_detail/159141.html}
*/
public void createFaceDb(String dbName) throws Exception {
com.aliyun.facebody20191230.Client client = createClient();
com.aliyun.facebody20191230.models.CreateFaceDbRequest request = new com.aliyun.facebody20191230.models.CreateFaceDbRequest();
request.setName(dbName);
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
client.createFaceDbWithOptions(request, runtime);
}
public String uploadImageUrl(String file) throws com.aliyuncs.exceptions.ClientException, IOException { public String uploadImageUrl(String file) throws com.aliyuncs.exceptions.ClientException, IOException {
FileUtils fileUtils = FileUtils.getInstance(this.accessKeyId, this.accessKeySecret); FileUtils fileUtils = FileUtils.getInstance(this.accessKeyId, this.accessKeySecret);
return fileUtils.upload(file); return fileUtils.upload(file);
......
...@@ -17,4 +17,8 @@ public class FaceService { ...@@ -17,4 +17,8 @@ public class FaceService {
public List<String> getFaceDbList() throws Exception { public List<String> getFaceDbList() throws Exception {
return face.getFaceDbList(); return face.getFaceDbList();
} }
public void createFaceDb(String dbName) throws Exception {
face.createFaceDb(dbName);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论