@ -28,28 +28,28 @@ public class TextToImage {
public static void main ( String [ ] args ) throws ApiException , InterruptedException {
LibLib api = new LibLib ( ak , sk ) ;
GetModelVersionRequest getModelVersionRequest = new GetModelVersionRequest ( ) ;
// Dream Tech XL | 筑梦工业XL
// https://www.liblib.art/modelinfo/5611e2f826be47f5b8c7eae45ed5434a?from=api&versionUuid=a57911b5dfe64c6aa78821be99367276
getModelVersionRequest . setVersionUuid ( "a57911b5dfe64c6aa78821be99367276" ) ;
VersionResponse modelVersion = api . getModelVersion ( getModelVersionRequest ) ;
if ( modelVersion . getData ( ) . getCommercialUse ( ) = = CommercialUseEnum . CommercialUse ) {
//显示模型信息
System . out . println ( modelVersion ) ;
}
TextToImageRequest request = new TextToImageRequest ( ) ;
TextToImageRequestGenerateParams params = new TextToImageRequestGenerateParams ( ) ;
params . checkPointId ( "a57911b5dfe64c6aa78821be99367276" ) ;
params . prompt ( "1 girl" ) . imgCount ( 2 ) ;
params . cfgScale ( 7.5 ) ;
ControlNet controlNet = new ControlNet ( ) ;
controlNet . width ( 1024 ) . height ( 768 ) ;
Map < String , Object > annoParams = new HashMap < > ( ) ;
Map < String , Object > cannyParams = new HashMap < > ( ) ;
cannyParams . put ( "preprocessorResolution" , 512 ) ;
annoParams . put ( "canny" , cannyParams ) ;
controlNet . unitOrder ( 1 ) ;
controlNet . model ( "efb97e9d8c237573298c3a5a7869b89c" ) . preprocessor ( 1 )
. sourceImage ( "https://liblibai-online.liblib.cloud/img/081e9f07d9bd4c2ba090efde163518f9/7c1cc38e-522c-43fe-aca9-07d5420d743e.png" )
. annotationParameters ( annoParams ) ;
params . addControlNetItem ( controlNet ) ;
params . vaeId ( "2c1a337416e029dd65ab58784e8a4763" ) ;
//提示词
params . prompt ( "Candid 35mm shot capturing an extremely attractive young beauty wearing black knitted outfit with sunglasses sitting inside a bus by the window at sunset with Vancouver street view outside the bus, motion blur, cinematic expired slide film, warm color tone, highly detailed, ultra-high resolutions, 32K UHD, best quality, masterpiece" )
. imgCount ( 1 ) ; //生成一张图片
// 参考图片右下方: https://www.liblib.art/imageinfo/13ea5cca203f4ca59db98956e213aaf0
params . cfgScale ( 6.5 ) ;
params . setWidth ( 1024 ) ;
params . setHeight ( 768 ) ;
params . setSteps ( 35 ) ;
params . setSampler ( 7 ) ;
params . seed ( 567454062 ) ;
request . generateParams ( params ) ;
request . templateUuid ( "6f7c4652458d4802969f8d089cf5b91f" ) ;