Update lollms_comfyui.py

This commit is contained in:
Saifeddine ALOUI 2024-06-16 01:33:11 +02:00 committed by GitHub
parent a303ce8037
commit 156968df95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -319,92 +319,68 @@ class LollmsComfyUI(LollmsTTI):
prompt_text = """ prompt_text = """
{ {
"3": { "1": {
"class_type": "KSampler",
"inputs": { "inputs": {
"cfg": 8, "base_ckpt_name": "juggernaut.safetensors",
"denoise": 1, "base_clip_skip": -2,
"latent_image": [ "refiner_ckpt_name": "None",
"5", "refiner_clip_skip": -2,
0 "positive_ascore": 6,
], "negative_ascore": 2,
"model": [ "vae_name": "Baked VAE",
"4", "positive": "smart robot icon, slick, flat design, high res, W in the center, black background",
0 "negative": "ugly, deformed, badly rendered, fuzzy",
], "token_normalization": "none",
"negative": [ "weight_interpretation": "comfy",
"7", "empty_latent_width": 1024,
0 "empty_latent_height": 1024,
], "batch_size": 3
"positive": [ },
"6", "class_type": "Eff. Loader SDXL",
0 "_meta": {
], "title": "Eff. Loader SDXL"
}
},
"2": {
"inputs": {
"noise_seed": 74738751167752,
"steps": 20,
"cfg": 7,
"sampler_name": "euler", "sampler_name": "euler",
"scheduler": "normal", "scheduler": "normal",
"seed": 8566257, "start_at_step": 0,
"steps": 20 "refine_at_step": -1,
} "preview_method": "auto",
}, "vae_decode": "true",
"4": { "sdxl_tuple": [
"class_type": "CheckpointLoaderSimple", "1",
"inputs": {
"""+f"""
"ckpt_name": "{self.app.config.comfyui_model}"
"""+"""
}
},
"5": {
"class_type": "EmptyLatentImage",
"inputs": {
"batch_size": 1,
"height": 512,
"width": 512
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"4",
1
],"""+f"""
"text": "{positive_prompt}"
"""+"""
}
},
"7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"4",
1
],"""+f"""
"text": "{negative_prompt}"
"""+"""
}
},
"8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"3",
0 0
], ],
"vae": [ "latent_image": [
"4", "1",
1
],
"optional_vae": [
"1",
2 2
] ]
},
"class_type": "KSampler SDXL (Eff.)",
"_meta": {
"title": "KSampler SDXL (Eff.)"
} }
}, },
"9": { "3": {
"class_type": "SaveImage",
"inputs": { "inputs": {
"filename_prefix": "ComfyUI", "filename_prefix": "ComfyUI",
"images": [ "images": [
"8", "2",
0 3
] ]
},
"class_type": "SaveImage",
"_meta": {
"title": "Save Image"
} }
} }
} }
@ -412,10 +388,9 @@ class LollmsComfyUI(LollmsTTI):
prompt = json.loads(prompt_text) prompt = json.loads(prompt_text)
#set the text prompt for our positive CLIPTextEncode #set the text prompt for our positive CLIPTextEncode
prompt["6"]["inputs"]["text"] = "masterpiece best quality man" prompt["1"]["inputs"]["positive"] = prompt_text
prompt["1"]["inputs"]["negative"] = negative_prompt
#set the seed for our KSampler node prompt["1"]["inputs"]["base_ckpt_name"] = self.app.config.comfyui_model
prompt["3"]["inputs"]["seed"] = 5
ws = websocket.WebSocket() ws = websocket.WebSocket()
ws.connect("ws://{}/ws?clientId={}".format(self.comfyui_base_url, client_id)) ws.connect("ws://{}/ws?clientId={}".format(self.comfyui_base_url, client_id))