TASK: 1、更换pose,重新生成templateId
2、brandDNA 开启分析attributes功能
This commit is contained in:
@@ -11,12 +11,18 @@ import java.util.stream.Collectors;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum PoseEnum {
|
public enum PoseEnum {
|
||||||
|
|
||||||
POSE_1(1, "aida-sys-image/pose/pose-1.mp4", "aida-sys-image/pose/pose-1.gif", "aida-sys-image/pose/pose-1-first_frame.jpeg", "AACT.8090e67b.-E3pujumEfCbDTI_rjSH-A.LwIlGT3j"),
|
// POSE_1(1, "aida-sys-image/pose/pose-1.mp4", "aida-sys-image/pose/pose-1.gif", "aida-sys-image/pose/pose-1-first_frame.jpeg", "AACT.8090e67b.-E3pujumEfCbDTI_rjSH-A.LwIlGT3j"),
|
||||||
POSE_2(2, "aida-sys-image/pose/pose-2.mp4", "aida-sys-image/pose/pose-2.gif", "aida-sys-image/pose/pose-2-first_frame.jpeg", "AACT.8090e67b.TwJLxEv3EfCbDTI_rjSH-A.IOQZCYhf"),
|
POSE_1(1, "aida-sys-image/pose/pose-1-1.mp4", "aida-sys-image/pose/pose-1-1.gif", "aida-sys-image/pose/pose-1-first_frame.jpeg", "AACT.8090e67b.qNMWJlyKEfCuORaRJeW4dg.x3wUteVO"),
|
||||||
POSE_3(3, "aida-sys-image/pose/pose-3.mp4", "aida-sys-image/pose/pose-3.gif", "aida-sys-image/pose/pose-3-first_frame.jpeg", "AACT.8090e67b.gd3OCkv4EfCxyZo8eQGF2Q.qMm-a1XI"),
|
// POSE_2(2, "aida-sys-image/pose/pose-2.mp4", "aida-sys-image/pose/pose-2.gif", "aida-sys-image/pose/pose-2-first_frame.jpeg", "AACT.8090e67b.TwJLxEv3EfCbDTI_rjSH-A.IOQZCYhf"),
|
||||||
POSE_4(4, "aida-sys-image/pose/pose-4.mp4", "aida-sys-image/pose/pose-4.gif", "aida-sys-image/pose/pose-4-first_frame.jpeg", "AACT.8090e67b.AUDnuEwDEfCEHBaRJeW4dg.rlx36xEY"),
|
POSE_2(2, "aida-sys-image/pose/pose-2-1.mp4", "aida-sys-image/pose/pose-2-1.gif", "aida-sys-image/pose/pose-2-first_frame.jpeg", "AACT.8090e67b.QpaGOlyLEfCuuJo8eQGF2Q.62EiJj-6"),
|
||||||
POSE_5(5, "aida-sys-image/pose/pose-5.mp4", "aida-sys-image/pose/pose-5.gif", "aida-sys-image/pose/pose-5-first_frame.jpeg", "AACT.8090e67b.G8BvkEwEEfCxyZo8eQGF2Q.fo4ryrgR"),
|
// POSE_3(3, "aida-sys-image/pose/pose-3.mp4", "aida-sys-image/pose/pose-3.gif", "aida-sys-image/pose/pose-3-first_frame.jpeg", "AACT.8090e67b.gd3OCkv4EfCxyZo8eQGF2Q.qMm-a1XI"),
|
||||||
POSE_6(6, "aida-sys-image/pose/pose-6.mp4", "aida-sys-image/pose/pose-6.gif", "aida-sys-image/pose/pose-6-first_frame.jpeg", "AACT.8090e67b.yBIPnEwEEfCxyZo8eQGF2Q.boSFwTG9");
|
POSE_3(3, "aida-sys-image/pose/pose-3-1.mp4", "aida-sys-image/pose/pose-3-1.gif", "aida-sys-image/pose/pose-3-first_frame.jpeg", "AACT.8090e67b.2q5qjFyLEfCImjI_rjSH-A.5cFMwOvi"),
|
||||||
|
// POSE_4(4, "aida-sys-image/pose/pose-4.mp4", "aida-sys-image/pose/pose-4.gif", "aida-sys-image/pose/pose-4-first_frame.jpeg", "AACT.8090e67b.AUDnuEwDEfCEHBaRJeW4dg.rlx36xEY"),
|
||||||
|
POSE_4(4, "aida-sys-image/pose/pose-4-1.mp4", "aida-sys-image/pose/pose-4-1.gif", "aida-sys-image/pose/pose-4-first_frame.jpeg", "AACT.8090e67b.KoYMplyPEfCuORaRJeW4dg.MuuBTG78"),
|
||||||
|
// POSE_5(5, "aida-sys-image/pose/pose-5.mp4", "aida-sys-image/pose/pose-5.gif", "aida-sys-image/pose/pose-5-first_frame.jpeg", "AACT.8090e67b.G8BvkEwEEfCxyZo8eQGF2Q.fo4ryrgR"),
|
||||||
|
POSE_5(5, "aida-sys-image/pose/pose-5-1.mp4", "aida-sys-image/pose/pose-5-1.gif", "aida-sys-image/pose/pose-5-first_frame.jpeg", "AACT.8090e67b.x54FNFyPEfCuuJo8eQGF2Q.P1egmEZ_"),
|
||||||
|
// POSE_6(6, "aida-sys-image/pose/pose-6.mp4", "aida-sys-image/pose/pose-6.gif", "aida-sys-image/pose/pose-6-first_frame.jpeg", "AACT.8090e67b.yBIPnEwEEfCxyZo8eQGF2Q.boSFwTG9");
|
||||||
|
POSE_6(6, "aida-sys-image/pose/pose-6-1.mp4", "aida-sys-image/pose/pose-6-1.gif", "aida-sys-image/pose/pose-6-first_frame.jpeg", "AACT.8090e67b.QSCvBlyQEfCImjI_rjSH-A.G9-Z5ffW");
|
||||||
|
|
||||||
|
|
||||||
private final Integer id;
|
private final Integer id;
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ public class QueryLibraryPageDTO extends PageQueryBaseVo {
|
|||||||
@ApiModelProperty("交集还是并集:1交集2并集")
|
@ApiModelProperty("交集还是并集:1交集2并集")
|
||||||
private Integer intersection;
|
private Integer intersection;
|
||||||
|
|
||||||
|
@ApiModelProperty("年龄段")
|
||||||
private String ageGroup;
|
private String ageGroup;
|
||||||
|
|
||||||
|
@ApiModelProperty("brandId")
|
||||||
private Long brandId;
|
private Long brandId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4011,7 +4011,7 @@ public class PythonService {
|
|||||||
//关闭FastJson的引用检测 防止出现$ref 现象
|
//关闭FastJson的引用检测 防止出现$ref 现象
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("image_url", url);
|
map.put("image_url", url);
|
||||||
map.put("is_brand_dna", Boolean.FALSE);
|
map.put("is_brand_dna", Boolean.TRUE);
|
||||||
log.info("bright请求python 参数:####{}", map);
|
log.info("bright请求python 参数:####{}", map);
|
||||||
String param = JSON.toJSONString(map, SerializerFeature.WriteNullStringAsEmpty);
|
String param = JSON.toJSONString(map, SerializerFeature.WriteNullStringAsEmpty);
|
||||||
log.info(param);
|
log.info(param);
|
||||||
|
|||||||
@@ -1244,7 +1244,6 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
ArrayList<PoseTransformationVO> poseTransformationVOS = new ArrayList<>();
|
ArrayList<PoseTransformationVO> poseTransformationVOS = new ArrayList<>();
|
||||||
for (String taskId : taskIdList) {
|
for (String taskId : taskIdList) {
|
||||||
String type = resolveModelType(taskId, CreditsEventsEnum.POSE_TRANSFORMATION.getValue());
|
String type = resolveModelType(taskId, CreditsEventsEnum.POSE_TRANSFORMATION.getValue());
|
||||||
PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
|
||||||
|
|
||||||
String key = generateResultKey + ":" + taskId;
|
String key = generateResultKey + ":" + taskId;
|
||||||
String resultJson = redisUtil.getFromString(key);
|
String resultJson = redisUtil.getFromString(key);
|
||||||
@@ -1266,11 +1265,15 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
} else {
|
} else {
|
||||||
poseTransformationVO = new PoseTransformationVO(taskId, "Executing");
|
poseTransformationVO = new PoseTransformationVO(taskId, "Executing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
||||||
|
if (Objects.nonNull(poseTransformation)) {
|
||||||
ToProductImageResult productResultByPath = getProductResultByPath(poseTransformation.getProductImage());
|
ToProductImageResult productResultByPath = getProductResultByPath(poseTransformation.getProductImage());
|
||||||
if (Objects.nonNull(productResultByPath)) {
|
if (Objects.nonNull(productResultByPath)) {
|
||||||
Long parentId = userLikeGroupService.getParentIdByElementIdAndElementType(productResultByPath.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue());
|
Long parentId = userLikeGroupService.getParentIdByElementIdAndElementType(productResultByPath.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue());
|
||||||
poseTransformationVO.setParentId(parentId);
|
poseTransformationVO.setParentId(parentId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
poseTransformationVOS.add(poseTransformationVO);
|
poseTransformationVOS.add(poseTransformationVO);
|
||||||
}
|
}
|
||||||
return poseTransformationVOS;
|
return poseTransformationVOS;
|
||||||
@@ -1380,6 +1383,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private LibraryModelPointService libraryModelPointService;
|
private LibraryModelPointService libraryModelPointService;
|
||||||
|
|
||||||
public String modifyModelProportion(ModifyModelProportionDTO proportionDTO) {
|
public String modifyModelProportion(ModifyModelProportionDTO proportionDTO) {
|
||||||
log.info("modifyModelProportion params: {}", proportionDTO);
|
log.info("modifyModelProportion params: {}", proportionDTO);
|
||||||
String name;
|
String name;
|
||||||
@@ -1434,6 +1438,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
* String collagePicture(Base64)
|
* String collagePicture(Base64)
|
||||||
* List<DTO(id, type)> elements
|
* List<DTO(id, type)> elements
|
||||||
* File file
|
* File file
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -1580,6 +1585,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建异步任务
|
* 创建异步任务
|
||||||
|
*
|
||||||
* @return taskId
|
* @return taskId
|
||||||
*/
|
*/
|
||||||
public String createAsyncTask(GenerateThroughImageTextDTO generateThroughImageTextDTO) {
|
public String createAsyncTask(GenerateThroughImageTextDTO generateThroughImageTextDTO) {
|
||||||
@@ -1633,8 +1639,9 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取异步任务结果
|
* 获取异步任务结果
|
||||||
|
*
|
||||||
* @param taskId 任务id
|
* @param taskId 任务id
|
||||||
* */
|
*/
|
||||||
public GenerateResultVO getAsyncTaskResult(String taskId) {
|
public GenerateResultVO getAsyncTaskResult(String taskId) {
|
||||||
ImageSynthesis imageSynthesis = new ImageSynthesis();
|
ImageSynthesis imageSynthesis = new ImageSynthesis();
|
||||||
ImageSynthesisResult result = null;
|
ImageSynthesisResult result = null;
|
||||||
@@ -1706,6 +1713,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
private static final String TEMPLATE_ID_GEN = "https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/aa-template-generation/";
|
private static final String TEMPLATE_ID_GEN = "https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/aa-template-generation/";
|
||||||
private static final String GET_ASYNC_RESULT = "https://dashscope.aliyuncs.com/api/v1/tasks/";
|
private static final String GET_ASYNC_RESULT = "https://dashscope.aliyuncs.com/api/v1/tasks/";
|
||||||
private static final String ANIMATE = "https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/video-synthesis/";
|
private static final String ANIMATE = "https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/video-synthesis/";
|
||||||
|
|
||||||
public String animateAnyone(PoseTransformDTO poseTransformDTO, Long accountId) {
|
public String animateAnyone(PoseTransformDTO poseTransformDTO, Long accountId) {
|
||||||
String inputImage = poseTransformDTO.getProductImage();
|
String inputImage = poseTransformDTO.getProductImage();
|
||||||
String inputImageUrl = minioUtil.getPreSignedUrl(inputImage, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
String inputImageUrl = minioUtil.getPreSignedUrl(inputImage, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||||
@@ -1941,6 +1949,10 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
Long accountId = poseTransformation.getAccountId();
|
Long accountId = poseTransformation.getAccountId();
|
||||||
Boolean flag = creditsService.taskCreditsDeduction(accountId, taskId);
|
Boolean flag = creditsService.taskCreditsDeduction(accountId, taskId);
|
||||||
if (flag) creditsService.updateChangedCredits(String.valueOf(accountId), taskId);
|
if (flag) creditsService.updateChangedCredits(String.valueOf(accountId), taskId);
|
||||||
|
|
||||||
|
// 保存数据到redis
|
||||||
|
String key = generateResultKey + ":" + taskId;
|
||||||
|
redisUtil.addToString(key, new Gson().toJson(poseTransformationVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STATUS_FAILED:
|
case STATUS_FAILED:
|
||||||
@@ -1958,9 +1970,6 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
poseTransformationVO.setStatus("Fail");
|
poseTransformationVO.setStatus("Fail");
|
||||||
}
|
}
|
||||||
poseTransformationVO.setTaskId(taskId);
|
poseTransformationVO.setTaskId(taskId);
|
||||||
// 保存数据到redis
|
|
||||||
String key = generateResultKey + ":" + taskId;
|
|
||||||
redisUtil.addToString(key, new Gson().toJson(poseTransformationVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
|
||||||
|
|
||||||
return poseTransformationVO;
|
return poseTransformationVO;
|
||||||
}
|
}
|
||||||
@@ -2172,6 +2181,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 接入flux模型,用于imageToSketch(sketch extract) || relighting || to product image
|
* 接入flux模型,用于imageToSketch(sketch extract) || relighting || to product image
|
||||||
|
*
|
||||||
* @param func 功能枚举名
|
* @param func 功能枚举名
|
||||||
* @param prompt 用户输入
|
* @param prompt 用户输入
|
||||||
* @param imagePath 图片minio路径
|
* @param imagePath 图片minio路径
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import com.ai.da.service.ProductImageService;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.netty.util.internal.StringUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
@@ -29,6 +31,7 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class ProductImageServiceImpl implements ProductImageService {
|
public class ProductImageServiceImpl implements ProductImageService {
|
||||||
|
|
||||||
@@ -87,17 +90,18 @@ public class ProductImageServiceImpl implements ProductImageService {
|
|||||||
category = obj.getString("category_male");
|
category = obj.getString("category_male");
|
||||||
}*/
|
}*/
|
||||||
String imgUrl = obj.getString("img_url");
|
String imgUrl = obj.getString("img_url");
|
||||||
// JSONObject attribute = obj.getJSONObject("attribute");
|
JSONObject attribute = obj.getJSONObject("attribute");
|
||||||
// AttributeRecognitionJSON attrJSON = attribute.toJavaObject(AttributeRecognitionJSON.class);
|
AttributeRecognitionJSON attrJSON = attribute.toJavaObject(AttributeRecognitionJSON.class);
|
||||||
// ProductImageAttribute attr = toAttrDict(attrJSON);
|
ProductImageAttribute attr = toAttrDict(attrJSON);
|
||||||
ProductImageAttribute attr = new ProductImageAttribute();
|
// ProductImageAttribute attr = new ProductImageAttribute();
|
||||||
attr.setGender(gender);
|
attr.setGender(gender);
|
||||||
attr.setCategory(category);
|
attr.setCategory(category);
|
||||||
attr.setImgUrl(imgUrl);
|
attr.setImgUrl(imgUrl);
|
||||||
attr.setLibraryId(libraryId);
|
attr.setLibraryId(libraryId);
|
||||||
String imageName = UUID.randomUUID().toString();
|
String imageName = UUID.randomUUID().toString();
|
||||||
String objectName = userHolder.getId() + "/imageToSketch/" + imageName;
|
String objectName = userHolder.getId() + "/imageToSketch/" + imageName;
|
||||||
String sketchPath = pythonService.imageToSketch(imgUrl, userBucket, objectName, "2", "");
|
String productImagePath = StringUtil.isNullOrEmpty(imgUrl) ? url : imgUrl;
|
||||||
|
String sketchPath = pythonService.imageToSketch(productImagePath, userBucket, objectName, "2", "");
|
||||||
attr.setImgUrl(sketchPath);
|
attr.setImgUrl(sketchPath);
|
||||||
productImageAttributeMapper.insert(attr);
|
productImageAttributeMapper.insert(attr);
|
||||||
}
|
}
|
||||||
@@ -110,7 +114,7 @@ public class ProductImageServiceImpl implements ProductImageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println(e.getMessage());
|
log.error(e.getMessage());
|
||||||
// log.error("初始化失败", e);
|
// log.error("初始化失败", e);
|
||||||
redisUtil.setTaskProgressDTO(progressKey, new ProgressDTO(0, 0, true));
|
redisUtil.setTaskProgressDTO(progressKey, new ProgressDTO(0, 0, true));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user