TInkDD commited on
Commit
84abfd0
·
verified ·
1 Parent(s): 8f7af3e

text01.json

Browse files

{
"4": {
"inputs": {
"ckpt_name": "SDXL_2.0-kill-com-checkpoints.safetensors"
},
"class_type": "CheckpointLoaderSimple",
"_meta": {
"title": "Load Checkpoint"
}
},
"8": {
"inputs": {
"samples": [
"383",
1
],
"vae": [
"4",
2
]
},
"class_type": "VAEDecode",
"_meta": {
"title": "VAE Decode"
}
},
"14": {
"inputs": {
"lora_name": "SDXL_kill-com-loras-v1.0.0.safetensors",
"strength_model": 0.8,
"strength_clip": 0.8,
"model": [
"473",
0
],
"clip": [
"473",
1
]
},
"class_type": "LoraLoader",
"_meta": {
"title": "Load LoRA"
}
},
"28": {
"inputs": {
"image": "basic_Image.jpg",
"upload": "image"
},
"class_type": "LoadImage",
"_meta": {
"title": "Load Image"
}
},
"47": {
"inputs": {
"text": [
"285",
0
],
"token_normalization": "none",
"weight_interpretation": "A1111",
"clip": [
"14",
1
]
},
"class_type": "BNK_CLIPTextEncodeAdvanced",
"_meta": {
"title": "CLIP Text Encode (Advanced)"
}
},
"48": {
"inputs": {
"text": "worst quality,low quality,normal quality,lowres,normal quality,Ordinary, unattractive, unattractive,woman,human",
"token_normalization": "none",
"weight_interpretation": "A1111",
"clip": [
"14",
1
]
},
"class_type": "BNK_CLIPTextEncodeAdvanced",
"_meta": {
"title": "CLIP Text Encode (Advanced)"
}
},
"102": {
"inputs": {
"positive": [
"180",
0
],
"negative": [
"429",
0
],
"vae": [
"4",
2
],
"pixels": [
"325",
0
],
"mask": [
"399",
0
]
},
"class_type": "InpaintModelConditioning",
"_meta": {
"title": "InpaintModelConditioning"
}
},
"111": {
"inputs": {
"invert_mask": false,
"blend_mode": "normal",
"opacity": 100,
"x_percent": 50,
"y_percent": 50,
"mirror": "None",
"scale": [
"409",
0
],
"aspect_ratio": 1,
"rotate": 0,
"transform_method": "lanczos",
"anti_aliasing": 0,
"background_image": [
"113",
0
],
"layer_image": [
"347",
0
],
"layer_mask": [
"347",
1
]
},
"class_type": "LayerUtility: ImageBlendAdvance",
"_meta": {
"title": "LayerUtility: ImageBlendAdvance"
}
},
"113": {
"inputs": {
"width": 960,
"height": 960,
"color": "#FFFFFF"
},
"class_type": "LayerUtility: ColorImage",
"_meta": {
"title": "LayerUtility: ColorImage"
}
},
"130": {
"inputs": {
"amount": 4,
"samples": [
"102",
2
]
},
"class_type": "RepeatLatentBatch",
"_meta": {
"title": "Repeat Latent Batch"
}
},
"179": {
"inputs": {
"control_net_name": "SDXL_union-promax-1.0.safetensors"
},
"class_type": "ControlNetLoader",
"_meta": {
"title": "Load ControlNet Model"
}
},
"180": {
"inputs": {
"strength": 0.8,
"conditioning": [
"485",
0
],
"control_net": [
"179",
0
],
"image": [
"495",
0
]
},
"class_type": "ControlNetApply",
"_meta": {
"title": "Apply ControlNet"
}
},
"261": {
"inputs": {
"text1": [
"415",
0
],
"text2": [
"355",
0
],
"separator": ","
},
"class_type": "CR Text Concatenate",
"_meta": {
"title": "🔤 CR Text Concatenate"
}
},
"285": {
"inputs": {
"text1": [
"261",
0
],
"text2": [
"292",
0
],
"separator": ","
},
"class_type": "CR Text Concatenate",
"_meta": {
"title": "🔤 CR Text Concatenate"
}
},
"292": {
"inputs": {
"string": ""
},
"class_type": "String Literal",
"_meta": {
"title": "ai_design_style"
}
},
"295": {
"inputs": {
"filename_prefix": "ComfyUI",
"with_workflow": false,
"metadata_extra": [
"285",
0
],
"image": [
"8",
0
]
},
"class_type": "Save image with extra metadata [Crystools]",
"_meta": {
"title": "🪛 Save image with extra metadata"
}
},
"325": {
"inputs": {
"invert_mask": false,
"blend_mode": "darken",
"opacity": 80,
"color": "#bebebe",
"background_image": [
"113",
0
],
"layer_image": [
"111",
0
],
"layer_mask": [
"111",
1
]
},
"class_type": "LayerStyle: ColorOverlay V2",
"_meta": {
"title": "LayerStyle: ColorOverlay V2"
}
},
"345": {
"inputs": {
"invert_mask": false,
"detect": "mask_area",
"top_reserve": 0,
"bottom_reserve": 0,
"left_reserve": 0,
"right_reserve": 0,
"round_to_multiple": "8",
"image": [
"396",
0
],
"mask": [
"396",
1
]
},
"class_type": "LayerUtility: CropByMask V2",
"_meta": {
"title": "LayerUtility: CropByMask V2"
}
},
"347": {
"inputs": {
"fit": "letterbox",
"method": "lanczos",
"scale_as": [
"113",
0
],
"image": [
"345",
0
],
"mask": [
"345",
1
]
},
"class_type": "LayerUtility: ImageMaskScaleAs",
"_meta": {
"title": "LayerUtility: ImageMaskScaleAs"
}
},
"355": {
"inputs": {
"from_translate": "auto",
"to_translate": "en",
"manual_translate": false,
"Manual Trasnlate": "Manual Trasnlate",
"text": ""
},
"class_type": "GoogleTranslateTextNode",
"_meta": {
"title": "user_input"
}
},
"356": {
"inputs": {
"expand": 5,
"tapered_corners": true,
"mask": [
"111",
1
]
},
"class_type": "GrowMask",
"_meta": {
"title": "GrowMask"
}
},
"379": {
"inputs": {
"scheduler": "karras",
"steps": 30,
"denoise": 1,
"model": [
"482",
0
]
},
"class_type": "BasicScheduler",
"_meta": {
"title": "BasicScheduler"
}
},
"380": {
"inputs": {
"sampler_name": "uni_pc_bh2"
},
"class_type": "KSamplerSelect",
"_meta": {
"title": "KSamplerSelect"
}
},
"381": {
"inputs": {
"cfg": 5,
"model": [
"482",
0
],
"positive": [
"102",
0
],
"negative": [
"102",
1
]
},
"class_type": "CFGGuider",
"_meta": {
"title": "CFGGuider"
}
},
"382": {
"inputs": {
"noise_seed": 1010949608153021
},
"class_type": "RandomNoise",
"_meta": {
"title": "RandomNoise"
}
},
"383": {
"inputs": {
"noise": [
"382",
0
],
"guider": [
"381",
0
],
"sampler": [
"380",
0
],
"sigmas": [
"379",
0
],
"latent_image": [
"130",
0
]
},
"class_type": "SamplerCustomAdvanced",
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"392": {
"inputs": {
"invert_mask": false,
"blend_mode": "multiply",
"opacity": 30,
"color": "#bebebe",
"background_image": [
"113",
0
],
"layer_image": [
"111",
0
],
"layer_mask": [
"111",
1
]
},
"class_type": "LayerStyle: ColorOverlay V2",
"_meta": {
"title": "LayerStyle: ColorOverlay V2"
}
},
"393": {
"inputs": {
"low_threshold": 0.11,
"high_threshold": 0.16,
"image": [
"392",
0
]
},
"class_type": "Canny",
"_meta": {
"title": "Canny"
}
},
"396": {
"inputs": {
"torchscript_jit": "default",
"image": [
"28",
0
]
},
"class_type": "InspyrenetRembg",
"_meta": {
"title": "Inspyrenet Rembg"
}
},
"399": {
"inputs": {
"expand": 5,
"tapered_corners": true,
"mask": [
"356",
0
]
},
"class_type": "GrowMask",
"_meta": {
"title": "GrowMask"
}
},
"408": {
"inputs": {
"value": 0.6
},
"class_type": "easy float",
"_meta": {
"title": "Float"
}
},
"409": {
"inputs": {
"select": [
"453",
0
],
"sel_mode": false,
"input1": [
"410",
0
],
"input2": [
"408",
0
],
"input3": [
"425",
0
]
},
"class_type": "SEGSSwitch",
"_meta": {
"title": "Switch (SEGS/legacy)"
}
},
"410": {
"inputs": {
"value": 0.85
},
"class_type": "easy float",
"_meta": {
"title": "Float"
}
},
"415": {
"inputs": {
"select": [
"453",
0
],
"sel_mode": false,
"input1": [
"416",
0
],
"input2": [
"416",
1
],
"input3": [
"416",
2
]
},
"class_type": "SEGSSwitch",
"_meta": {
"title": "Switch (SEGS/legacy)"
}
},
"416": {
"inputs": {
"text": "Brand name,Skincare,4K",
"text_b": "Face cream, Brand name,jar,Skincare",
"text_c": "Facial mask,Brand name,artistic fonts",
"text_d": ""
},
"class_type": "Text String",
"_meta": {
"title": "Text String"
}
},
"425": {
"inputs": {
"value": 0.9
},
"class_type": "easy float",
"_meta": {
"title": "Float"
}
},
"429": {

Files changed (1) hide show
  1. prompt.py +77 -0
prompt.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import random
3
+ from pathlib import Path
4
+
5
+ import gradio as gr
6
+ from PIL import Image
7
+ from migration import migration_1
8
+ from background_design import background_design
9
+ from settings import COMFY_UI_PATH
10
+ from websockets_api import get_prompt_images
11
+
12
+ image_hose = "image\image_hose.png"
13
+ image_Long_bottle = "image\image_Long_bottle.png"
14
+ image_mask = "image\image_mask.png"
15
+ mage_vial = "image\image_vial.png"
16
+
17
+ prompt1 = "Translucent,flowing,soft,illusory,mixed,dreamlike, watercolor,pigment,impressionist,paper texture,colorful,text"
18
+ prompt2 = "Chinese painting,Transparent,high-end,high-end feel,transparency,Zen,inspired,Traditional,Minimalism,Works of Qi Baishi"
19
+ prompt3 = "luxurious,High Fashion,haute couture,elegant,Hot stamping,embossing,Two tone gradient,High end craftsmanship,Glass"
20
+ prompt4 = "medicine,chemistry,White,red,Medical patternv,Technology,Logo"
21
+
22
+ def save_input_image(img):
23
+ input_img = Path(COMFY_UI_PATH) / "input/basic_Image.jpg"
24
+ pillow_image = Image.fromarray(img)
25
+ pillow_image.save(input_img)
26
+
27
+ def sentence_builder(img,prompt_1,style,classification,cfg_vlue,steps,sampler_name,Latent_Batch):
28
+ with open("text01.json", "r", encoding="utf-8") as f:
29
+ prompt = json.load(f)
30
+
31
+ prompt["382"]["inputs"]["noise_seed"] = random.randint(0, 999999999999)
32
+ prompt["292"]["inputs"]["string"] = f"{prompt_1}"
33
+ prompt["496"]["inputs"]["style"] = style
34
+ prompt["434"]["inputs"]["string"] = f"{classification}"
35
+ prompt["381"]["inputs"]["cfg"] = cfg_vlue
36
+ prompt["379"]["inputs"]["steps"] = steps
37
+ prompt["380"]["inputs"]["sampler_name"] = f"{sampler_name}"
38
+ prompt["130"]["inputs"]["amount"] = Latent_Batch
39
+
40
+
41
+ save_input_image(img)
42
+ images = get_prompt_images(prompt)
43
+ return images
44
+
45
+ basic_wf = gr.Interface(
46
+ fn=sentence_builder,
47
+ inputs=[gr.Image(label="Style Image: ",width=710, height=710),
48
+
49
+ gr.Textbox(label="提示词"),
50
+ gr.Dropdown(
51
+ ["高级时尚", "医美", "水彩","中国风"], label="风格选择", info="选择你喜欢的风格"
52
+ ),
53
+ gr.CheckboxGroup(["窄口瓶", "面膜", "软管"], label="瓶型分类", info="瓶型的类型"),
54
+ gr.Slider(1, 10, value=5, step=1,label="CFG值", info="提高该值会使结果更加符合提示词,但过高会导致图像质量下降"),
55
+ gr.Slider(1, 50, value=30, step=1,label="steps", info="采样步数"),
56
+ gr.Dropdown(
57
+ ["euler", "dpmpp_2m", "dpmpp_2m_sde","dpmpp_2m_sde_gpu","dpmpp_3m_sde","dpmmpp_3m_sde_gpu","ddpm","lcm","ipndm","ddim","uni_pc","uni_pc_bh2" ], label="采样器", info="每个型号的采样器对生成的效果有"
58
+ ),
59
+ gr.Slider(1, 4, value=4, step=1, label="图片批次数", info="生成图片的批次数"),
60
+
61
+ ],
62
+ outputs=[gr.Gallery(label="Outputs: ",height=710)],
63
+ examples=[
64
+ [image_hose, prompt1,"水彩", ["软管"],5,30,"uni_pc_bh2",4],
65
+ [image_Long_bottle,prompt2,"中国风", ["窄口瓶"],5,30,"uni_pc_bh2",4],
66
+ [image_mask,prompt3,"高级时尚", ["面膜"],5,30,"uni_pc_bh2",4],
67
+ [mage_vial,prompt4,"医美", ["窄口瓶"],5,30,"uni_pc_bh2",4],
68
+ ],
69
+ title = "设计创意工作"
70
+ )
71
+ demo = gr.TabbedInterface(
72
+ interface_list=[basic_wf],
73
+ tab_names=["设计创意"])
74
+
75
+
76
+ demo.queue()
77
+ demo.launch(share=True)