From 731c418d1c0d18126ab8a6805db14c2cb883448c Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Fri, 7 Jun 2024 20:44:11 +0200 Subject: [PATCH] fixed errors --- lollms/functions/generate_image.py | 17 ++++++++++++++++- lollms/services/diffusers/lollms_diffusers.py | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lollms/functions/generate_image.py b/lollms/functions/generate_image.py index 783e455..1ac7019 100644 --- a/lollms/functions/generate_image.py +++ b/lollms/functions/generate_image.py @@ -27,7 +27,7 @@ def build_image(prompt, negative_prompt, width, height, processor:APScript, clie if not processor.personality.app.tti: from lollms.services.diffusers.lollms_diffusers import LollmsDiffusers processor.step_start("Loading ParisNeo's fork of AUTOMATIC1111's stable diffusion service") - processor.personality.app.tti = LollmsDiffusers(processor.personality.app, processor.personality.name, max_retries=-1,auto_sd_base_url=processor.personality.config.sd_base_url) + processor.personality.app.tti = LollmsDiffusers(processor.personality.app, processor.personality.name) processor.personality.app.sd = processor.personality.app.tti processor.step_end("Loading ParisNeo's fork of AUTOMATIC1111's stable diffusion service") file, infos = processor.personality.app.tti.paint( @@ -66,6 +66,21 @@ def build_image(prompt, negative_prompt, width, height, processor:APScript, clie output_path=client.discussion.discussion_folder ) processor.step_end("Painting") + elif processor.personality.config.active_tti_service=="comfyui": + if not processor.personality.app.tti: + from lollms.services.comfyui.lollms_comfyui import LollmsComfyUI + processor.step_start("Loading dalle service") + processor.personality.app.tti = LollmsComfyUI(processor.personality.app, comfyui_base_url=processor.personality) + processor.personality.app.dalle = processor.personality.app.tti + processor.step_end("Loading dalle service") + processor.step_start("Painting") + file = processor.personality.app.tti.paint( + prompt, + width = width, + height = height, + output_path=client.discussion.discussion_folder + ) + processor.step_end("Painting") file = str(file) escaped_url = discussion_path_to_url(file) diff --git a/lollms/services/diffusers/lollms_diffusers.py b/lollms/services/diffusers/lollms_diffusers.py index 5450f66..ff67fb7 100644 --- a/lollms/services/diffusers/lollms_diffusers.py +++ b/lollms/services/diffusers/lollms_diffusers.py @@ -121,6 +121,8 @@ class LollmsDiffusers(LollmsTTI): ASCIIColors.red(" |______| ") import torch + if not PackageManager.check_package_installed("diffusers"): + PackageManager.install_or_update("diffusers") from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image#PixArtSigmaPipeline self.model = AutoPipelineForText2Image.from_pretrained( app.config.diffusers_model, torch_dtype=torch.float16, cache_dir=self.models_dir,