main
HuangHai 2 months ago
parent b7bfd6f22c
commit 26473ca169

@ -0,0 +1,101 @@
package com.dsideal.aiSupport.Util.Liblib.Enum;
import lombok.Getter;
/**
* https://liblibai.feishu.cn/wiki/UAMVw67NcifQHukf8fpccgS5n6d
*
*
*/
@Getter
public enum SamplingMethod {
EULER_A("Euler a", 0),
EULER("Euler", 1),
LMS("LMS", 2),
HEUN("HEUN", 3),
DPM2("DPM2", 4),
DPM2_A("DPM2 a", 5),
DPM_PLUS_PLUS_2S_A("DPM++ 2S a", 6),
DPM_PLUS_PLUS_2M("DPM++ 2M", 7),
DPM_PLUS_PLUS_SDE("DPM++ SDE", 8),
DPM_PLUS_PLUS_FAST("DPM++ FAST", 9),
DPM_PLUS_PLUS_ADAPTIVE("DPM++ Adaptive", 10),
LMS_KARRAS("LMS Karras", 11),
DPM2_KARRAS("DPM2 Karras", 12),
DPM2_A_KARRAS("DPM2 a Karras", 13),
DPM_PLUS_PLUS_2S_A_KARRAS("DPM++ 2S a", 14),
DPM_PLUS_PLUS_2M_KARRAS("DPM++ 2M Karras", 15),
DPM_PLUS_PLUS_SDE_KARRAS("DPM++ SDE Karras", 16),
DDIM("DDIM", 17),
PLMS("PLMS", 18),
UNIPC("UNIPC", 19),
DPM_PLUS_PLUS_2M_SDE_KARRAS("DPM++ 2M SDE Karras", 20),
DPM_PLUS_PLUS_2M_SDE_EXPONENTIAL("DPM++ 2M SDE EXPONENTIAL", 21),
DPM_PLUS_PLUS_2M_SDE_HEUN_KARRAS("DPM++ 2M SDE Heun Karras", 24),
DPM_PLUS_PLUS_2M_SDE_HEUN_EXPONENTIAL("DPM++ 2M SDE Heun Exponential", 25),
DPM_PLUS_PLUS_3M_SDE_KARRAS("DPM++ 3M SDE Karras", 27),
DPM_PLUS_PLUS_3M_SDE_EXPONENTIAL("DPM++ 3M SDE Exponential", 28),
RESTART("Restart", 29),
LCM("LCM", 30);
/**
* -- GETTER --
*
*
* @return
*/
private final String name;
/**
* -- GETTER --
*
*
* @return
*/
private final int value;
/**
*
*
* @param name
* @param value
*/
SamplingMethod(String name, int value) {
this.name = name;
this.value = value;
}
/**
*
*
* @param value
* @return null
*/
public static SamplingMethod fromValue(int value) {
for (SamplingMethod method : SamplingMethod.values()) {
if (method.getValue() == value) {
return method;
}
}
return null;
}
/**
*
*
* @param name
* @return null
*/
public static SamplingMethod fromName(String name) {
for (SamplingMethod method : SamplingMethod.values()) {
if (method.getName().equalsIgnoreCase(name)) {
return method;
}
}
return null;
}
@Override
public String toString() {
return name;
}
}

@ -4,6 +4,7 @@ import cloud.liblibai.client.LibLib;
import cloud.liblibai.openapi.client.ApiException;
import cloud.liblibai.openapi.client.model.*;
import com.dsideal.aiSupport.Plugin.YamlProp;
import com.dsideal.aiSupport.Util.Liblib.Enum.SamplingMethod;
import com.jfinal.kit.Prop;
import static com.dsideal.aiSupport.AiSupportApplication.getEnvPrefix;
@ -37,9 +38,11 @@ public class TextToImage2 {
TextToImageRequestGenerateParams params = new TextToImageRequestGenerateParams();
params.checkPointId("ee0b113517dc4b5ca1ab4499db72cda1");
//提示词
params.prompt("<lora:KTDW-000028:1>,3D cartoon style,This is a highly detailed CGI artwork depicting a young girl and a small rabbit in a serene, sunlit garden. The girl, with fair skin and large, expressive brown eyes, has her dark brown hair tied up with a yellow ribbon. She is wearing a sleeveless, floral dress in pastel shades of pink, green, and yellow. The girl is sitting on a beige, cushioned lounge chair, holding an open book in her hands. Beside her, a cute, fluffy rabbit with large ears and soft brown fur is also looking at the book. The background is a lush, green garden with blurred, sunlit foliage and white daisies, creating a dreamy atmosphere. Butterflies, one yellow and one orange, flutter around the scene, adding to the whimsical feel. The overall color palette is soft and warm, enhancing the peaceful and idyllic setting., (masterpiece:1.3),( best quality:1.3),(high detail:1.3)")
.imgCount(1);//生成一张图片
params.negativePrompt("over sharpening,dirt,bad color matching,graying,(worst quality:2),(low quality:2),(normal quality:2),(Proportional imbalance:1.5),wrong perspective,distorted person,Twisted Car,(lowres:1.1),(monochrome),(grayscale),blurry,signature,drawing,graffiti,text,word,logo,cropped,out of frame,ugly,deformed,noisy,(low contrast:1.3),painting,illustration,NSFW,EasyNegative");
String prompt = "<lora:KTDW-000028:1>,3D cartoon style,This is a highly detailed CGI artwork depicting a young girl and a small rabbit in a serene, sunlit garden. The girl, with fair skin and large, expressive brown eyes, has her dark brown hair tied up with a yellow ribbon. She is wearing a sleeveless, floral dress in pastel shades of pink, green, and yellow. The girl is sitting on a beige, cushioned lounge chair, holding an open book in her hands. Beside her, a cute, fluffy rabbit with large ears and soft brown fur is also looking at the book. The background is a lush, green garden with blurred, sunlit foliage and white daisies, creating a dreamy atmosphere. Butterflies, one yellow and one orange, flutter around the scene, adding to the whimsical feel. The overall color palette is soft and warm, enhancing the peaceful and idyllic setting., (masterpiece:1.3),( best quality:1.3),(high detail:1.3)";
params.prompt(prompt).imgCount(1);//生成一张图片
//反向提示词
String negativePrompt = "over sharpening,dirt,bad color matching,graying,(worst quality:2),(low quality:2),(normal quality:2),(Proportional imbalance:1.5),wrong perspective,distorted person,Twisted Car,(lowres:1.1),(monochrome),(grayscale),blurry,signature,drawing,graffiti,text,word,logo,cropped,out of frame,ugly,deformed,noisy,(low contrast:1.3),painting,illustration,NSFW,EasyNegative";
params.negativePrompt(negativePrompt);
// 参考图片右下方:
// https://www.liblib.art/imageinfo/13ea5cca203f4ca59db98956e213aaf0
params.cfgScale(1.0);
@ -47,7 +50,8 @@ public class TextToImage2 {
params.setHeight(1360);
params.setSteps(30);
//https://liblibai.feishu.cn/wiki/UAMVw67NcifQHukf8fpccgS5n6d
params.setSampler(1);
// 黄海自定义了枚举类,这样方便对照文档中的枚举值
params.setSampler(SamplingMethod.EULER_A.getValue());
params.seed(1430455276);
request.generateParams(params);

Loading…
Cancel
Save