|
|
|
|
@@ -55,11 +55,13 @@ public class PythonService {
|
|
|
|
|
private DesignHistoryService designHistoryService;
|
|
|
|
|
@Value("${access.python.ip:''}")
|
|
|
|
|
private String accessPythonIp;
|
|
|
|
|
@Value("${access.python.port:''}")
|
|
|
|
|
private String accessPythonPort;
|
|
|
|
|
@Resource
|
|
|
|
|
private PythonTAllInfoService pythonTAllInfoService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成打印的图片 二合一
|
|
|
|
|
* 生成打印的图片 二合一 (废弃于2024/01/02)
|
|
|
|
|
*
|
|
|
|
|
* @param printPath
|
|
|
|
|
* @return
|
|
|
|
|
@@ -83,7 +85,7 @@ public class PythonService {
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
// .url(accessPythonIp + ":9999/aifda/api/v1.0/fusion_test")
|
|
|
|
|
.url(accessPythonIp + ":9991/api/image_fusion")
|
|
|
|
|
.url(accessPythonIp + ":" + accessPythonPort + "/api/image_fusion")
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
|
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
|
|
@@ -1684,7 +1686,7 @@ public class PythonService {
|
|
|
|
|
log.info("design请求python 参数:####{}", param);
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, param);
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url("http://18.167.251.121:9991/api/design")
|
|
|
|
|
.url(accessPythonIp + ":" + accessPythonPort + "/api/design")
|
|
|
|
|
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
|
|
|
|
@@ -1717,7 +1719,7 @@ public class PythonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成高级图片
|
|
|
|
|
* 生成高级图片(废弃)
|
|
|
|
|
*
|
|
|
|
|
* @param designPath
|
|
|
|
|
* @return
|
|
|
|
|
@@ -1790,7 +1792,7 @@ public class PythonService {
|
|
|
|
|
System.out.println(JSON.toJSONString(content));
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url("http://18.167.251.121:9991/api/attribute_retrieve")
|
|
|
|
|
.url(accessPythonIp + ":" + accessPythonPort + "/api/attribute_retrieve")
|
|
|
|
|
// .url(accessPythonIp+":9991/aifda/api/v1.0/attribute_retrieval")
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
|
|
|
|
@@ -2155,7 +2157,7 @@ public class PythonService {
|
|
|
|
|
log.info("design请求python 参数:####{}", param);
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, param);
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url("http://18.167.251.121:9991/api/design")
|
|
|
|
|
.url(accessPythonIp + ":" + accessPythonPort + "/api/design")
|
|
|
|
|
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
|
|
|
|
@@ -2191,7 +2193,7 @@ public class PythonService {
|
|
|
|
|
throw new BusinessException("design.interface.exception");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 暂时未用 */
|
|
|
|
|
public String generateSketchCaption(String url) {
|
|
|
|
|
//限流校验
|
|
|
|
|
AccessLimitUtils.validate("generateSketchCaption", 5);
|
|
|
|
|
@@ -2204,7 +2206,7 @@ public class PythonService {
|
|
|
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, url);
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url(accessPythonIp + ":2828/aida/interrogator")
|
|
|
|
|
.url(accessPythonIp + ":" + accessPythonPort + "/aida/interrogator")
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
|
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
|
|
@@ -2250,13 +2252,13 @@ public class PythonService {
|
|
|
|
|
content.put("category", category);
|
|
|
|
|
content.put("mode", mode);
|
|
|
|
|
content.put("str", text);
|
|
|
|
|
content.put("version", modelName);
|
|
|
|
|
content.put("version", "1");
|
|
|
|
|
content.put("gender", gender);
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content, SerializerFeature.WriteMapNullValue));
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
// .url(accessPythonIp + ":2828/aida/diffusion")
|
|
|
|
|
// .url("http://18.167.251.121:9992")
|
|
|
|
|
.url("http://18.167.251.121:9991/api/diffusion")
|
|
|
|
|
.url(accessPythonIp + ":" + accessPythonPort + "/api/diffusion")
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
|
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
|
|
@@ -2309,7 +2311,7 @@ public class PythonService {
|
|
|
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, content);
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url("http://18.167.251.121" + ":" + portAndRoute)
|
|
|
|
|
.url(accessPythonIp + ":" + accessPythonPort + portAndRoute)
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
|
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
|
|
@@ -2345,7 +2347,7 @@ public class PythonService {
|
|
|
|
|
String jsonString = JSON.toJSONString(content, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
|
|
|
|
|
|
|
// todo 添加限流
|
|
|
|
|
Response response = this.sendPostToModel(jsonString, "9991/api/preview_control", "composeLayers");
|
|
|
|
|
Response response = this.sendPostToModel(jsonString, "/api/preview_control", "composeLayers");
|
|
|
|
|
// todo 结束限流
|
|
|
|
|
|
|
|
|
|
String bodyString;
|
|
|
|
|
@@ -2386,7 +2388,7 @@ public class PythonService {
|
|
|
|
|
String jsonString = JSON.toJSONString(contents, SerializerFeature.WriteNullStringAsEmpty);
|
|
|
|
|
|
|
|
|
|
// todo 添加限流
|
|
|
|
|
Response response = this.sendPostToModel(jsonString, "9991/api/category_recognition", "getClothCategory");
|
|
|
|
|
Response response = this.sendPostToModel(jsonString, "/api/category_recognition", "getClothCategory");
|
|
|
|
|
// todo 结束限流
|
|
|
|
|
|
|
|
|
|
String bodyString;
|
|
|
|
|
|