TASK: 新增pose transfer模特姿势选项
This commit is contained in:
@@ -1416,13 +1416,12 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getAllPose(){
|
||||
String posePath = "aida-sys-image/pose/pose-1.gif";
|
||||
String firstFramePath = "aida-sys-image/pose/pose-1-first_frame.jpeg";
|
||||
HashMap<String, String> resp = new HashMap<>();
|
||||
// todo 以后要返回poseId
|
||||
resp.put("gif", minioUtil.getPreSignedUrl(posePath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
resp.put("firstFrame", minioUtil.getPreSignedUrl(firstFramePath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
return Arrays.asList(resp);
|
||||
List<Map<String, String>> propertyList = PoseEnum.getPropertyList();
|
||||
propertyList.forEach(item -> {
|
||||
item.put("gif", minioUtil.getPreSignedUrl(item.get("gif"), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
item.put("firstFrame", minioUtil.getPreSignedUrl(item.get("firstFrame"), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
});
|
||||
return propertyList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1687,13 +1686,13 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
|
||||
// 轮询配置
|
||||
private static final int MAX_RETRIES = 30; // 最大重试次数
|
||||
private static final int POLL_INTERVAL = 2000; // 轮询间隔(毫秒)
|
||||
private static final int POLL_INTERVAL = 20000; // 轮询间隔(毫秒)
|
||||
|
||||
public String getVideoTemplateId(String videoPath){
|
||||
String key = RedisUtil.ANIMATE_ANYONE_TEMPLATE_ID + videoPath;
|
||||
String templateId = redisUtil.getFromString(key);
|
||||
boolean contains = PoseEnum.getVideoList().contains(videoPath);
|
||||
|
||||
if (StringUtil.isNullOrEmpty(templateId)){
|
||||
String templateId;
|
||||
if (!contains){
|
||||
String videoUrl = minioUtil.getPreSignedUrl(videoPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
JSONObject requestBody = new JSONObject();
|
||||
requestBody.set("model", "animate-anyone-template-gen2");
|
||||
@@ -1703,8 +1702,8 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
requestBody.set("input", input);
|
||||
requestBody.set("parameters", parameters);
|
||||
|
||||
String resp = sendRequestUtil.sendPost(TEMPLATE_ID_GEN, requestBody.toString());
|
||||
|
||||
log.info("获取pose的模板id 请求数据:{}", requestBody);
|
||||
String resp = sendRequestUtil.sendAliYunPostAsync(TEMPLATE_ID_GEN, requestBody.toString());
|
||||
if (StringUtil.isNullOrEmpty(resp)){
|
||||
throw new BusinessException("请求获取video template id失败");
|
||||
}
|
||||
@@ -1719,7 +1718,8 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
throw new BusinessException("获取动作模板失败");
|
||||
}
|
||||
// templateId = "AACT.8090e67b.-E3pujumEfCbDTI_rjSH-A.LwIlGT3j";
|
||||
redisUtil.addToString(key, templateId);
|
||||
} else {
|
||||
templateId = PoseEnum.getByVideoPath(videoPath).getTemplateId();
|
||||
}
|
||||
|
||||
return templateId;
|
||||
|
||||
Reference in New Issue
Block a user