mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
+11
-3
@@ -356,8 +356,14 @@ def process_samples(p: StableDiffusionProcessing, samples):
|
||||
pp = scripts_manager.PostprocessImageArgs(image)
|
||||
p.scripts.postprocess_image(p, pp)
|
||||
if pp.image is not None:
|
||||
image = pp.image
|
||||
|
||||
if isinstance(pp.image, list) and len(pp.image) > 0: # post process image can return original+processed
|
||||
for i, img in enumerate(pp.image):
|
||||
if i+1 < len(pp.image):
|
||||
out_images.append(img)
|
||||
out_infotexts.append(f"Postprocess image {i+1}")
|
||||
image = pp.image[-1]
|
||||
else:
|
||||
image = pp.image
|
||||
grading_params = processing_grading.GradingParams(
|
||||
brightness=getattr(p, 'grading_brightness', 0.0),
|
||||
contrast=getattr(p, 'grading_contrast', 0.0),
|
||||
@@ -609,7 +615,9 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||
audio=audio,
|
||||
)
|
||||
if p.scripts is not None and isinstance(p.scripts, scripts_manager.ScriptRunner) and not (shared.state.interrupted or shared.state.skipped):
|
||||
p.scripts.postprocess(p, results)
|
||||
_results = p.scripts.postprocess(p, results)
|
||||
if _results is not None:
|
||||
results = _results
|
||||
timer.process.record('post')
|
||||
p.ops = list(set(p.ops))
|
||||
t3 = time.time()
|
||||
|
||||
@@ -743,15 +743,19 @@ class ScriptRunner:
|
||||
|
||||
def postprocess(self, p: StableDiffusionProcessing, processed):
|
||||
s = ScriptSummary('postprocess')
|
||||
_processed = processed
|
||||
for script in self.alwayson_scripts:
|
||||
try:
|
||||
args = resolve_script_args(script, p.script_args, p.per_script_args)
|
||||
if args is not None:
|
||||
script.postprocess(p, processed, *args)
|
||||
result = script.postprocess(p, _processed, *args)
|
||||
if result is not None: # allow postprocessing script to optionally modify results
|
||||
_processed = result
|
||||
except Exception as e:
|
||||
errors.display(e, f'Running script postprocess: {script.filename}')
|
||||
s.record(script.title())
|
||||
s.report()
|
||||
return _processed
|
||||
|
||||
def postprocess_batch(self, p: StableDiffusionProcessing, images, **kwargs):
|
||||
s = ScriptSummary('postprocess-batch')
|
||||
|
||||
@@ -499,6 +499,7 @@ def create_settings(cmd_opts):
|
||||
"openvino_cache_path": OptionInfo('cache', "Folder for OpenVINO cache", folder=True),
|
||||
"onnx_cached_models_path": OptionInfo(os.path.join(paths.models_path, 'ONNX', 'cache'), "Folder for ONNX cached models", folder=True),
|
||||
"onnx_temp_dir": OptionInfo(os.path.join(paths.models_path, 'ONNX', 'temp'), "Folder for ONNX conversion", folder=True),
|
||||
"dlss_pkg_path": OptionInfo('', "Folder with DLSS package", gr.Textbox, { "visible": False}),
|
||||
}))
|
||||
|
||||
# --- Image Options ---
|
||||
|
||||
@@ -23,13 +23,13 @@ sort = '⇕'
|
||||
detect = '📐'
|
||||
folder = '📂'
|
||||
random = '🎲️'
|
||||
reuse = '♻️'
|
||||
info = 'ℹ' # noqa
|
||||
reset = '🔄'
|
||||
upload = '⬆️'
|
||||
loading = '↺'
|
||||
reuse = '⬅️'
|
||||
search = '🔍'
|
||||
tools = '🛠'
|
||||
preview = '🖼️'
|
||||
image = '🖌️'
|
||||
resize = '⁜'
|
||||
|
||||
Reference in New Issue
Block a user