Merge branch 'dev/dev_xp' into dev/dev
This commit is contained in:
@@ -31,6 +31,8 @@ public class PoseTransformation extends BaseEntity {
|
|||||||
|
|
||||||
private byte isDeleted;
|
private byte isDeleted;
|
||||||
|
|
||||||
|
private String modelName;
|
||||||
|
|
||||||
public PoseTransformation() {
|
public PoseTransformation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import io.minio.errors.MinioException;
|
|||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
import org.apache.http.client.config.RequestConfig;
|
import org.apache.http.client.config.RequestConfig;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
@@ -692,7 +691,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
GenerateResultVO generateResultVO = new Gson().fromJson(redisUtil.getFromString(key), GenerateResultVO.class);
|
GenerateResultVO generateResultVO = new Gson().fromJson(redisUtil.getFromString(key), GenerateResultVO.class);
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
type = resolveModelType(taskId);
|
type = resolveModelType(taskId, null);
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
// 暂定万象每次生成1个
|
// 暂定万象每次生成1个
|
||||||
@@ -1124,16 +1123,17 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
// 3、生成唯一id 使用uuid,由于uuid重复的几率很小,故取消对uuid重复性的校验
|
// 3、生成唯一id 使用uuid,由于uuid重复的几率很小,故取消对uuid重复性的校验
|
||||||
String taskId;
|
String taskId;
|
||||||
Boolean flag = false;
|
Boolean flag = false;
|
||||||
|
PoseTransformation poseTransformation = new PoseTransformation();
|
||||||
if (poseTransformDTO.getModelName().equals("wx")){
|
if (poseTransformDTO.getModelName().equals("wx")){
|
||||||
taskId = animateAnyone(poseTransformDTO, accountId);
|
taskId = animateAnyone(poseTransformDTO, accountId);
|
||||||
if (!StringUtil.isNullOrEmpty(taskId)) flag = true;
|
if (!StringUtil.isNullOrEmpty(taskId)) flag = true;
|
||||||
|
poseTransformation.setModelName("wx");
|
||||||
}else {
|
}else {
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
taskId = uuid + "-" + accountId;
|
taskId = uuid + "-" + accountId;
|
||||||
flag = pythonService.poseTransformation(productImage, poseId, taskId);
|
flag = pythonService.poseTransformation(productImage, poseId, taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
PoseTransformation poseTransformation = new PoseTransformation();
|
|
||||||
poseTransformation.setProjectId(projectId);
|
poseTransformation.setProjectId(projectId);
|
||||||
poseTransformation.setAccountId(accountId);
|
poseTransformation.setAccountId(accountId);
|
||||||
poseTransformation.setUniqueId(taskId);
|
poseTransformation.setUniqueId(taskId);
|
||||||
@@ -1192,7 +1192,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PoseTransformationVO getPoseTransformationResult(String taskId){
|
public PoseTransformationVO getPoseTransformationResult(String taskId){
|
||||||
String type = resolveModelType(taskId);
|
String type = resolveModelType(taskId, CreditsEventsEnum.POSE_TRANSFORMATION.getValue());
|
||||||
if (type.equals("wx")){
|
if (type.equals("wx")){
|
||||||
return getAnimateResult(taskId);
|
return getAnimateResult(taskId);
|
||||||
}
|
}
|
||||||
@@ -2021,8 +2021,19 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String resolveModelType(String taskId){
|
private String resolveModelType(String taskId, String func){
|
||||||
// 判断当前task来自哪个模型
|
// 判断当前task来自哪个模型
|
||||||
|
if (!StringUtil.isNullOrEmpty(func)
|
||||||
|
&& func.equals(CreditsEventsEnum.POSE_TRANSFORMATION.getValue())){
|
||||||
|
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(
|
||||||
|
new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
||||||
|
if (!poseTransformations.isEmpty() && poseTransformations.get(0).getModelName().equals("wx")){
|
||||||
|
return "wx";
|
||||||
|
}else {
|
||||||
|
return "local";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Generate generate = selectByUniqueId(taskId);
|
Generate generate = selectByUniqueId(taskId);
|
||||||
if (Objects.nonNull(generate) &&
|
if (Objects.nonNull(generate) &&
|
||||||
!StringUtil.isNullOrEmpty(generate.getModelName()) &&
|
!StringUtil.isNullOrEmpty(generate.getModelName()) &&
|
||||||
|
|||||||
Reference in New Issue
Block a user