mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-19 20:57:58 +00:00
Update lollms_diffusers.py
This commit is contained in:
parent
242bdb68dc
commit
97f237360b
@ -238,13 +238,31 @@ class LollmsDiffusers(LollmsTTI):
|
||||
self.model.scheduler = sc
|
||||
width = adjust_dimensions(int(width))
|
||||
height = adjust_dimensions(int(height))
|
||||
|
||||
|
||||
def process_output_path(output_path, self_output_dir):
|
||||
if output_path is None:
|
||||
output_path = Path(self_output_dir)
|
||||
fn = find_next_available_filename(output_path, "diff_img_")
|
||||
else:
|
||||
output_path = Path(output_path)
|
||||
if output_path.is_file():
|
||||
fn = output_path
|
||||
elif output_path.is_dir():
|
||||
fn = find_next_available_filename(output_path, "diff_img_")
|
||||
else:
|
||||
# If the path doesn't exist, assume it's intended to be a file
|
||||
fn = output_path
|
||||
|
||||
return fn
|
||||
|
||||
|
||||
# Usage in the original context
|
||||
if output_path is None:
|
||||
output_path = self.output_dir
|
||||
output_path = Path(output_path)
|
||||
fn = find_next_available_filename(output_path,"diff_img_")
|
||||
else:
|
||||
output_path = Path(output_path)
|
||||
fn = output_path
|
||||
|
||||
fn = process_output_path(output_path, self.output_dir)
|
||||
|
||||
if seed!=-1:
|
||||
generator = torch.Generator("cuda").manual_seed(seed)
|
||||
image = self.model(positive_prompt, negative_prompt=negative_prompt, height=height, width=width, guidance_scale=scale, num_inference_steps=steps, generator=generator).images[0]
|
||||
|
Loading…
Reference in New Issue
Block a user