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,103 +319,78 @@ class LollmsComfyUI(LollmsTTI):
prompt_text = """ prompt_text = """
{ {
"3": { "1": {
"class_type": "KSampler", "inputs": {
"inputs": { "base_ckpt_name": "juggernaut.safetensors",
"cfg": 8, "base_clip_skip": -2,
"denoise": 1, "refiner_ckpt_name": "None",
"latent_image": [ "refiner_clip_skip": -2,
"5", "positive_ascore": 6,
0 "negative_ascore": 2,
], "vae_name": "Baked VAE",
"model": [ "positive": "smart robot icon, slick, flat design, high res, W in the center, black background",
"4", "negative": "ugly, deformed, badly rendered, fuzzy",
0 "token_normalization": "none",
], "weight_interpretation": "comfy",
"negative": [ "empty_latent_width": 1024,
"7", "empty_latent_height": 1024,
0 "batch_size": 3
],
"positive": [
"6",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 8566257,
"steps": 20
}
}, },
"4": { "class_type": "Eff. Loader SDXL",
"class_type": "CheckpointLoaderSimple", "_meta": {
"inputs": { "title": "Eff. Loader SDXL"
"""+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
],
"vae": [
"4",
2
]
}
},
"9": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"8",
0
]
}
} }
},
"2": {
"inputs": {
"noise_seed": 74738751167752,
"steps": 20,
"cfg": 7,
"sampler_name": "euler",
"scheduler": "normal",
"start_at_step": 0,
"refine_at_step": -1,
"preview_method": "auto",
"vae_decode": "true",
"sdxl_tuple": [
"1",
0
],
"latent_image": [
"1",
1
],
"optional_vae": [
"1",
2
]
},
"class_type": "KSampler SDXL (Eff.)",
"_meta": {
"title": "KSampler SDXL (Eff.)"
}
},
"3": {
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"2",
3
]
},
"class_type": "SaveImage",
"_meta": {
"title": "Save Image"
}
}
} }
""" """
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))