generate 添加Logo与Slogan

This commit is contained in:
2024-06-03 17:13:48 +08:00
parent 86e7119cfb
commit 49b086ad10
10 changed files with 261 additions and 102 deletions

View File

@@ -66,7 +66,7 @@ public class PythonService {
private String accessPythonIp;
@Value("${access.python.port:''}")
private String accessPythonPort;
@Value("${access.python.sr}")
@Value("${access.python.address}")
private String srPythonPort;
@Value("${minio.bucketName.gradient}")
private String gradientBucketName;
@@ -2936,7 +2936,7 @@ public class PythonService {
throw new BusinessException("system error!");
}
public Boolean generateSketchOrPrint(GenerateToPythonDTO generateToPythonDTO) {
public Boolean generateSketchOrPrint(String params, String servicePath) {
//限流校验
// AccessLimitUtils.validate("generateSketchOrPrint", 5);
OkHttpClient client = new OkHttpClient().newBuilder()
@@ -2946,13 +2946,14 @@ public class PythonService {
.writeTimeout(60, TimeUnit.SECONDS)//写入超时(单位:秒)
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(generateToPythonDTO, SerializerFeature.WriteMapNullValue));
// RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(generateToPythonDTO, SerializerFeature.WriteMapNullValue));
RequestBody body = RequestBody.create(mediaType, params);
Request request = new Request.Builder()
// .url("http://18.167.251.121:9992")
// .url("http://127.0.0.1:5000/api/diffusion")
// .url(accessPythonIp + ":" + accessPythonPort + "/api/diffusion")
// .url(accessPythonIp + ":" + accessPythonPort + "/api/generate_image")
.url(srPythonPort + "/api/generate_image")
.url(srPythonPort + servicePath)
.method("POST", body)
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
@@ -2960,7 +2961,8 @@ public class PythonService {
Response response = null;
String bodyString;
try {
log.info("generateSketchOrPrint请求入参content###{}", JSON.toJSONString(generateToPythonDTO, SerializerFeature.WriteMapNullValue));
// log.info("generateSketchOrPrint请求入参content###{}", JSON.toJSONString(generateToPythonDTO, SerializerFeature.WriteMapNullValue));
log.info("generateSketchOrPrint请求入参content###{}", params);
response = client.newCall(request).execute();
} catch (IOException ioException) {
log.error("PythonService##generateSketchOrPrint异常###{}", ExceptionUtil.getThrowableList(ioException));