mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
infotext apply styles and fix progress bar
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -94,6 +94,9 @@ def get_progress(req: models.ReqProgress = Depends()):
|
||||
batch_x = max(shared.state.job_no, 0)
|
||||
batch_y = max(shared.state.job_count, 1)
|
||||
step_x = max(shared.state.sampling_step, 0)
|
||||
prev_steps = max(shared.state.sampling_steps, 1)
|
||||
while step_x > shared.state.sampling_steps:
|
||||
shared.state.sampling_steps += prev_steps
|
||||
step_y = max(shared.state.sampling_steps, 1)
|
||||
current = step_y * batch_x + step_x
|
||||
total = step_y * batch_y
|
||||
@@ -101,6 +104,7 @@ def get_progress(req: models.ReqProgress = Depends()):
|
||||
time_since_start = time.time() - shared.state.time_start
|
||||
eta_relative = (time_since_start / progress) - time_since_start if progress > 0 else 0
|
||||
# shared.log.critical(f'get_progress: batch {batch_x}/{batch_y} step {step_x}/{step_y} current {current}/{total} time={time_since_start} eta={eta_relative}')
|
||||
# shared.log.critical(shared.state)
|
||||
res = models.ResProgress(id=shared.state.id, progress=round(progress, 2), eta_relative=round(eta_relative, 2), current_image=current_image, textinfo=shared.state.textinfo, state=shared.state.dict(), )
|
||||
return res
|
||||
|
||||
|
||||
@@ -237,8 +237,10 @@ def connect_paste(button, local_paste_fields, input_comp, override_settings_comp
|
||||
if hasattr(output, "step") and type(output.step) == float:
|
||||
valtype = float
|
||||
debug(f'Paste: "{key}"="{v}" type={valtype} var={vars(output)}')
|
||||
if valtype == bool and v == "False":
|
||||
val = False
|
||||
if valtype == bool:
|
||||
val = False if v.lower() == "false" else True
|
||||
elif valtype == list:
|
||||
val = v if isinstance(v, list) else [item.strip() for item in v.split(',')]
|
||||
else:
|
||||
val = valtype(v)
|
||||
res.append(gr.update(value=val))
|
||||
|
||||
@@ -507,7 +507,7 @@ def update_sampler(p, sd_model, second_pass=False):
|
||||
def get_job_name(p, model):
|
||||
if hasattr(model, 'pipe'):
|
||||
model = model.pipe
|
||||
if hasattr(p, 'xyz'):
|
||||
if getattr(p, 'xyz', False):
|
||||
return 'Ignore' # xyz grid handles its own jobs
|
||||
if sd_models.get_diffusers_task(model) == sd_models.DiffusersTaskType.TEXT_2_IMAGE:
|
||||
return 'Text'
|
||||
|
||||
@@ -231,7 +231,7 @@ class State:
|
||||
self.sampling_steps = steps
|
||||
self.job_count = jobs
|
||||
else:
|
||||
self.sampling_steps += steps * jobs
|
||||
self.sampling_steps += (steps * jobs)
|
||||
self.job_count += jobs
|
||||
self.job = job
|
||||
self.history('update')
|
||||
|
||||
@@ -368,6 +368,9 @@ class StyleDatabase:
|
||||
return
|
||||
for style in p.styles:
|
||||
s = self.find_style(style)
|
||||
if s == self.no_style:
|
||||
shared.log.warning(f'Apply style: name="{style}" not found')
|
||||
continue
|
||||
apply_styles_to_extra(p, s)
|
||||
|
||||
def extract_comments(self, p):
|
||||
|
||||
@@ -619,6 +619,7 @@ def create_ui(_blocks: gr.Blocks=None):
|
||||
# prompt
|
||||
(prompt, "Prompt"),
|
||||
(negative, "Negative prompt"),
|
||||
(styles, "Styles"),
|
||||
# input
|
||||
(denoising_strength, "Denoising strength"),
|
||||
# size basic
|
||||
|
||||
@@ -236,6 +236,7 @@ def create_ui():
|
||||
# prompt
|
||||
(img2img_prompt, "Prompt"),
|
||||
(img2img_negative_prompt, "Negative prompt"),
|
||||
(img2img_prompt_styles, "Styles"),
|
||||
# sampler
|
||||
(sampler_index, "Sampler"),
|
||||
(steps, "Steps"),
|
||||
|
||||
@@ -92,6 +92,7 @@ def create_ui():
|
||||
# prompt
|
||||
(txt2img_prompt, "Prompt"),
|
||||
(txt2img_negative_prompt, "Negative prompt"),
|
||||
(txt2img_prompt_styles, "Styles"),
|
||||
# main
|
||||
(width, "Size-1"),
|
||||
(height, "Size-2"),
|
||||
|
||||
Reference in New Issue
Block a user