mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-02-08 03:50:22 +00:00
Update lollms_comfyui.py
This commit is contained in:
parent
c70a6ddf24
commit
81c77715d9
@ -272,6 +272,8 @@ class LollmsComfyUI(LollmsTTI):
|
|||||||
restore_faces=True,
|
restore_faces=True,
|
||||||
output_path=None
|
output_path=None
|
||||||
):
|
):
|
||||||
|
if output_path is None:
|
||||||
|
output_path = self.output_dir
|
||||||
client_id = str(uuid.uuid4())
|
client_id = str(uuid.uuid4())
|
||||||
url = self.comfyui_base_url[7:-1]
|
url = self.comfyui_base_url[7:-1]
|
||||||
|
|
||||||
@ -335,7 +337,7 @@ class LollmsComfyUI(LollmsTTI):
|
|||||||
"weight_interpretation": "comfy",
|
"weight_interpretation": "comfy",
|
||||||
"empty_latent_width": 1024,
|
"empty_latent_width": 1024,
|
||||||
"empty_latent_height": 1024,
|
"empty_latent_height": 1024,
|
||||||
"batch_size": 3
|
"batch_size": 1
|
||||||
},
|
},
|
||||||
"class_type": "Eff. Loader SDXL",
|
"class_type": "Eff. Loader SDXL",
|
||||||
"_meta": {
|
"_meta": {
|
||||||
@ -386,7 +388,19 @@ class LollmsComfyUI(LollmsTTI):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
def save_images(images, folder_path):
|
||||||
|
# Create the folder if it doesn't exist
|
||||||
|
folder = Path(folder_path)
|
||||||
|
folder.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# Save each image to the folder
|
||||||
|
for i, img_data in enumerate(images):
|
||||||
|
img_path = folder / f'image_{i+1}.png'
|
||||||
|
with open(img_path, 'wb') as img_file:
|
||||||
|
img_file.write(base64.b64decode(img_data))
|
||||||
|
|
||||||
|
# Return the path to the first image
|
||||||
|
return str(folder / 'image_1.png')
|
||||||
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["1"]["inputs"]["positive"] = prompt_text
|
prompt["1"]["inputs"]["positive"] = prompt_text
|
||||||
@ -396,7 +410,9 @@ class LollmsComfyUI(LollmsTTI):
|
|||||||
ws = websocket.WebSocket()
|
ws = websocket.WebSocket()
|
||||||
ws.connect("ws://{}/ws?clientId={}".format(url, client_id))
|
ws.connect("ws://{}/ws?clientId={}".format(url, client_id))
|
||||||
images = get_images(ws, prompt)
|
images = get_images(ws, prompt)
|
||||||
return images
|
|
||||||
|
return save_images(images, output_path), {"prompt":prompt,"negative_prompt":negative_prompt}
|
||||||
|
|
||||||
|
|
||||||
def paint_from_images(self, positive_prompt: str,
|
def paint_from_images(self, positive_prompt: str,
|
||||||
images: List[str],
|
images: List[str],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user