当style为洛丽塔时无sketch和谷歌风控问题FIX
This commit is contained in:
@@ -39,6 +39,7 @@ import org.springframework.util.StringUtils;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -406,6 +407,7 @@ public class PythonService {
|
|||||||
// if (CollectionUtil.isEmpty(pinData)) {
|
// if (CollectionUtil.isEmpty(pinData)) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/// / long topNum = sketchBoardElements.stream()
|
/// / long topNum = sketchBoardElements.stream()
|
||||||
/// / .filter(skecth -> skecth.getHasPin() == 1
|
/// / .filter(skecth -> skecth.getHasPin() == 1
|
||||||
/// / && DesignPythonItem.OUTWEAR_DRESS_BLOUSE.contains(skecth.getLevel2Type())).count();
|
/// / && DesignPythonItem.OUTWEAR_DRESS_BLOUSE.contains(skecth.getLevel2Type())).count();
|
||||||
@@ -681,7 +683,9 @@ public class PythonService {
|
|||||||
// 其他所有情况,都回退到使用系统推荐
|
// 其他所有情况,都回退到使用系统推荐
|
||||||
String categoryParam = elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase();
|
String categoryParam = elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase();
|
||||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale(), elementVO.getStyle());
|
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale(), elementVO.getStyle());
|
||||||
|
if (recommentdUrlList.size() == 0) {
|
||||||
|
recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale(), null);
|
||||||
|
}
|
||||||
if (CollectionUtils.isEmpty(recommentdUrlList)) {
|
if (CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||||
throw new BusinessException("failed.to.obtain.system.sketch.recommendation");
|
throw new BusinessException("failed.to.obtain.system.sketch.recommendation");
|
||||||
}
|
}
|
||||||
@@ -3442,7 +3446,10 @@ public class PythonService {
|
|||||||
|
|
||||||
return imageUrlList;
|
return imageUrlList;
|
||||||
}*/
|
}*/
|
||||||
/** 废弃状态 */
|
|
||||||
|
/**
|
||||||
|
* 废弃状态
|
||||||
|
*/
|
||||||
public String composeLayers(List<OutfitDetailPythonItem> layersDetail) {
|
public String composeLayers(List<OutfitDetailPythonItem> layersDetail) {
|
||||||
HashMap<String, List<OutfitDetailPythonItem>> layers = new HashMap<>();
|
HashMap<String, List<OutfitDetailPythonItem>> layers = new HashMap<>();
|
||||||
HashMap<String, HashMap<String, List<OutfitDetailPythonItem>>> content = new HashMap<>();
|
HashMap<String, HashMap<String, List<OutfitDetailPythonItem>>> content = new HashMap<>();
|
||||||
@@ -4114,6 +4121,7 @@ public class PythonService {
|
|||||||
//生成失败
|
//生成失败
|
||||||
throw new BusinessException("segProduct.interface.exception");
|
throw new BusinessException("segProduct.interface.exception");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转发 seg_anything 请求到 python 服务
|
* 转发 seg_anything 请求到 python 服务
|
||||||
* 请求 body 由调用方组装(包含 user_id, image_path, type, points, labels, box 等)
|
* 请求 body 由调用方组装(包含 user_id, image_path, type, points, labels, box 等)
|
||||||
@@ -4185,6 +4193,7 @@ public class PythonService {
|
|||||||
log.error("PythonService##segAnything异常response###{}", response);
|
log.error("PythonService##segAnything异常response###{}", response);
|
||||||
throw new BusinessException("segAnything.interface.exception");
|
throw new BusinessException("segAnything.interface.exception");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean poseTransformation(JSONObject content, String apiUri) {
|
public Boolean poseTransformation(JSONObject content, String apiUri) {
|
||||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||||
.connectTimeout(30, TimeUnit.SECONDS)
|
.connectTimeout(30, TimeUnit.SECONDS)
|
||||||
@@ -4391,7 +4400,8 @@ public class PythonService {
|
|||||||
log.info("imageSegmentation 结果 : {}", jsonObject.get("data").toString());
|
log.info("imageSegmentation 结果 : {}", jsonObject.get("data").toString());
|
||||||
List<ImageSegmentation.ImageDate> seg = JSONObject.parseObject(
|
List<ImageSegmentation.ImageDate> seg = JSONObject.parseObject(
|
||||||
jsonObject.get("data").toString(),
|
jsonObject.get("data").toString(),
|
||||||
new TypeReference<List<ImageSegmentation.ImageDate>>() {}
|
new TypeReference<List<ImageSegmentation.ImageDate>>() {
|
||||||
|
}
|
||||||
);
|
);
|
||||||
return seg;
|
return seg;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1260,8 +1260,14 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
modelAndPromptMap.put(ModelConstants.USE_MODEL, ModelConstants.LOCAL_MODEL);
|
modelAndPromptMap.put(ModelConstants.USE_MODEL, ModelConstants.LOCAL_MODEL);
|
||||||
}
|
}
|
||||||
} else if (ModelConstants.SKETCHBOARD.equals(generateDTO.getLevel1Type())) {
|
} else if (ModelConstants.SKETCHBOARD.equals(generateDTO.getLevel1Type())) {
|
||||||
String prompt = generateDTO.getText() + "rules:front view sketch only,plain white background, single garment only, orthographic, centered on white background, borderless canvas, thin monochrome black line art.\n" +
|
String[] split = generateDTO.getText().split(",");
|
||||||
" No clothes hanger, no fake clothes hanger, no human-related lines, no color fill, no words, no text, no black background, no boundary or frame.";
|
String style = split[0].trim();
|
||||||
|
if ("Lolita".equals( style)){
|
||||||
|
style = "洛丽塔";
|
||||||
|
}
|
||||||
|
String userPrompt = split[1];
|
||||||
|
String prompt = userPrompt + "rules:front view sketch only,plain white background, single garment only, orthographic, centered on white background, borderless canvas, thin monochrome black line art.\n" +
|
||||||
|
" No clothes hanger, no fake clothes hanger, no human-related lines, no color fill, no words, no text, no black background, no boundary or frame.sketch style:"+ style;
|
||||||
modelAndPromptMap.put(ModelConstants.PROMPT, prompt);
|
modelAndPromptMap.put(ModelConstants.PROMPT, prompt);
|
||||||
if (isUseImage) {
|
if (isUseImage) {
|
||||||
if (ModelConstants.ADVANCED.equals(modelName)) {
|
if (ModelConstants.ADVANCED.equals(modelName)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user