|
|
|
@ -101,12 +101,21 @@ public class ImageToImageUltra {
|
|
|
|
|
generateParams.put("sampler", 1);
|
|
|
|
|
generateParams.put("steps", steps);
|
|
|
|
|
generateParams.put("restoreFaces", 0);
|
|
|
|
|
generateParams.put("sourceImage", sourceImageUrl);
|
|
|
|
|
|
|
|
|
|
// 构建ControlNet参数
|
|
|
|
|
JSONArray controlNetArray = new JSONArray();
|
|
|
|
|
JSONObject controlNet = new JSONObject();
|
|
|
|
|
controlNet.put("unitOrder", 0);
|
|
|
|
|
controlNet.put("sourceImage", sourceImageUrl);
|
|
|
|
|
/*
|
|
|
|
|
1. controlType:
|
|
|
|
|
1. line:线稿轮廓
|
|
|
|
|
2. depth:空间关系
|
|
|
|
|
3. pose:人物姿态
|
|
|
|
|
4. IPAdapter:风格迁移
|
|
|
|
|
2. controlImage:参考图可公网访问的完整URL
|
|
|
|
|
*/
|
|
|
|
|
controlNet.put("controlImage", sourceImageUrl);
|
|
|
|
|
controlNet.put("width", width);
|
|
|
|
|
controlNet.put("height", height);
|
|
|
|
|
controlNet.put("preprocessor", 68);
|
|
|
|
@ -126,8 +135,9 @@ public class ImageToImageUltra {
|
|
|
|
|
controlNet.put("resizeMode", 1);
|
|
|
|
|
|
|
|
|
|
// 添加ControlNet到数组
|
|
|
|
|
controlNetArray.add(controlNet);
|
|
|
|
|
generateParams.put("controlNet", controlNetArray);
|
|
|
|
|
// 暂不加载ControlNet
|
|
|
|
|
//controlNetArray.add(controlNet);
|
|
|
|
|
//generateParams.put("controlNet", controlNetArray);
|
|
|
|
|
|
|
|
|
|
// 将生成参数添加到请求体
|
|
|
|
|
requestBody.put("generateParams", generateParams);
|
|
|
|
@ -137,7 +147,7 @@ public class ImageToImageUltra {
|
|
|
|
|
|
|
|
|
|
// 生成签名信息
|
|
|
|
|
SignUtil.SignatureInfo signInfo = SignUtil.makeSignInfo(uri);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 构建带签名的URL
|
|
|
|
|
HttpUrl.Builder urlBuilder = HttpUrl.parse(API_BASE_URL + uri).newBuilder()
|
|
|
|
|
.addQueryParameter("AccessKey", accessKey)
|
|
|
|
@ -233,4 +243,4 @@ public class ImageToImageUltra {
|
|
|
|
|
log.error("图生图任务执行失败", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|