fixed errors

This commit is contained in:
Saifeddine ALOUI 2024-06-07 20:44:11 +02:00
parent ace17c5029
commit 731c418d1c
2 changed files with 18 additions and 1 deletions

View File

@ -27,7 +27,7 @@ def build_image(prompt, negative_prompt, width, height, processor:APScript, clie
if not processor.personality.app.tti: if not processor.personality.app.tti:
from lollms.services.diffusers.lollms_diffusers import LollmsDiffusers from lollms.services.diffusers.lollms_diffusers import LollmsDiffusers
processor.step_start("Loading ParisNeo's fork of AUTOMATIC1111's stable diffusion service") 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.personality.app.sd = processor.personality.app.tti
processor.step_end("Loading ParisNeo's fork of AUTOMATIC1111's stable diffusion service") processor.step_end("Loading ParisNeo's fork of AUTOMATIC1111's stable diffusion service")
file, infos = processor.personality.app.tti.paint( 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 output_path=client.discussion.discussion_folder
) )
processor.step_end("Painting") 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) file = str(file)
escaped_url = discussion_path_to_url(file) escaped_url = discussion_path_to_url(file)

View File

@ -121,6 +121,8 @@ class LollmsDiffusers(LollmsTTI):
ASCIIColors.red(" |______| ") ASCIIColors.red(" |______| ")
import torch import torch
if not PackageManager.check_package_installed("diffusers"):
PackageManager.install_or_update("diffusers")
from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image#PixArtSigmaPipeline from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image#PixArtSigmaPipeline
self.model = AutoPipelineForText2Image.from_pretrained( self.model = AutoPipelineForText2Image.from_pretrained(
app.config.diffusers_model, torch_dtype=torch.float16, cache_dir=self.models_dir, app.config.diffusers_model, torch_dtype=torch.float16, cache_dir=self.models_dir,