mirror of https://github.com/vladmandic/automatic
validate script_args
parent
8c562941ad
commit
6981262beb
|
|
@ -8,6 +8,7 @@ __pycache__
|
||||||
/styles.csv
|
/styles.csv
|
||||||
/user.css
|
/user.css
|
||||||
/webui-user.bat
|
/webui-user.bat
|
||||||
|
/webui-user.sh
|
||||||
/javascript/themes.json
|
/javascript/themes.json
|
||||||
venv
|
venv
|
||||||
|
|
||||||
|
|
|
||||||
2
TODO.md
2
TODO.md
|
|
@ -8,7 +8,7 @@ Stuff to be fixed...
|
||||||
- Run VAE with hires at 1280
|
- Run VAE with hires at 1280
|
||||||
- Transformers version
|
- Transformers version
|
||||||
- Move Restart Server from WebUI to Launch and reload modules
|
- Move Restart Server from WebUI to Launch and reload modules
|
||||||
- gr.Dropdowns with None selected
|
- follow-up on `p.script_args`
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1a97ebb43428b43c41001cfe79e50b468126d99f
|
Subproject commit ffe0553c59e91067ebf1e4fc7ad85ca9c870bf57
|
||||||
|
|
@ -154,13 +154,11 @@ class StableDiffusionProcessing:
|
||||||
self.override_settings_restore_afterwards = override_settings_restore_afterwards
|
self.override_settings_restore_afterwards = override_settings_restore_afterwards
|
||||||
self.is_using_inpainting_conditioning = False
|
self.is_using_inpainting_conditioning = False
|
||||||
self.disable_extra_networks = False
|
self.disable_extra_networks = False
|
||||||
|
|
||||||
if not seed_enable_extras:
|
if not seed_enable_extras:
|
||||||
self.subseed = -1
|
self.subseed = -1
|
||||||
self.subseed_strength = 0
|
self.subseed_strength = 0
|
||||||
self.seed_resize_from_h = 0
|
self.seed_resize_from_h = 0
|
||||||
self.seed_resize_from_w = 0
|
self.seed_resize_from_w = 0
|
||||||
|
|
||||||
self.scripts = None
|
self.scripts = None
|
||||||
self.script_args = script_args
|
self.script_args = script_args
|
||||||
self.all_prompts = None
|
self.all_prompts = None
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,8 @@ import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from rich import print # pylint: disable=redefined-builtin
|
||||||
import gradio as gr
|
import gradio as gr
|
||||||
|
|
||||||
from modules import shared, paths, script_callbacks, extensions, script_loading, scripts_postprocessing, errors
|
from modules import shared, paths, script_callbacks, extensions, script_loading, scripts_postprocessing, errors
|
||||||
|
|
||||||
AlwaysVisible = object()
|
AlwaysVisible = object()
|
||||||
|
|
@ -418,6 +417,8 @@ class ScriptRunner:
|
||||||
def process(self, p):
|
def process(self, p):
|
||||||
for script in self.alwayson_scripts:
|
for script in self.alwayson_scripts:
|
||||||
try:
|
try:
|
||||||
|
if p.script_args[0] == 'enabled':
|
||||||
|
return
|
||||||
script_args = p.script_args[script.args_from:script.args_to]
|
script_args = p.script_args[script.args_from:script.args_to]
|
||||||
script.process(p, *script_args)
|
script.process(p, *script_args)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -434,6 +435,8 @@ class ScriptRunner:
|
||||||
def process_batch(self, p, **kwargs):
|
def process_batch(self, p, **kwargs):
|
||||||
for script in self.alwayson_scripts:
|
for script in self.alwayson_scripts:
|
||||||
try:
|
try:
|
||||||
|
if p.script_args[0] == 'enabled':
|
||||||
|
return
|
||||||
script_args = p.script_args[script.args_from:script.args_to]
|
script_args = p.script_args[script.args_from:script.args_to]
|
||||||
script.process_batch(p, *script_args, **kwargs)
|
script.process_batch(p, *script_args, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -442,6 +445,8 @@ class ScriptRunner:
|
||||||
def postprocess(self, p, processed):
|
def postprocess(self, p, processed):
|
||||||
for script in self.alwayson_scripts:
|
for script in self.alwayson_scripts:
|
||||||
try:
|
try:
|
||||||
|
if p.script_args[0] == 'enabled':
|
||||||
|
return
|
||||||
script_args = p.script_args[script.args_from:script.args_to]
|
script_args = p.script_args[script.args_from:script.args_to]
|
||||||
script.postprocess(p, processed, *script_args)
|
script.postprocess(p, processed, *script_args)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -450,6 +455,8 @@ class ScriptRunner:
|
||||||
def postprocess_batch(self, p, images, **kwargs):
|
def postprocess_batch(self, p, images, **kwargs):
|
||||||
for script in self.alwayson_scripts:
|
for script in self.alwayson_scripts:
|
||||||
try:
|
try:
|
||||||
|
if p.script_args[0] == 'enabled':
|
||||||
|
return
|
||||||
script_args = p.script_args[script.args_from:script.args_to]
|
script_args = p.script_args[script.args_from:script.args_to]
|
||||||
script.postprocess_batch(p, *script_args, images=images, **kwargs)
|
script.postprocess_batch(p, *script_args, images=images, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
import modules.scripts
|
import modules.scripts
|
||||||
from modules import sd_samplers
|
from modules import sd_samplers
|
||||||
from modules.generation_parameters_copypaste import create_override_settings_dict
|
from modules.generation_parameters_copypaste import create_override_settings_dict
|
||||||
from modules.processing import StableDiffusionProcessing, Processed, StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img, process_images
|
from modules.processing import StableDiffusionProcessingTxt2Img, process_images
|
||||||
from modules.shared import opts
|
from modules.shared import opts
|
||||||
import modules.shared as shared
|
import modules.shared as shared
|
||||||
from modules.ui import plaintext_to_html
|
from modules.ui import plaintext_to_html
|
||||||
|
|
||||||
|
|
||||||
def txt2img(id_task: str, prompt: str, negative_prompt: str, prompt_styles, steps: int, sampler_index: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, height: int, width: int, enable_hr: bool, denoising_strength: float, hr_scale: float, hr_upscaler: str, hr_second_pass_steps: int, hr_resize_x: int, hr_resize_y: int, override_settings_texts, *args):
|
def txt2img(id_task: str, prompt: str, negative_prompt: str, prompt_styles, steps: int, sampler_index: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, height: int, width: int, enable_hr: bool, denoising_strength: float, hr_scale: float, hr_upscaler: str, hr_second_pass_steps: int, hr_resize_x: int, hr_resize_y: int, override_settings_texts, *args):
|
||||||
override_settings = create_override_settings_dict(override_settings_texts)
|
override_settings = create_override_settings_dict(override_settings_texts) # pylint: disable=unused-argument
|
||||||
p = StableDiffusionProcessingTxt2Img(
|
p = StableDiffusionProcessingTxt2Img(
|
||||||
sd_model=shared.sd_model,
|
sd_model=shared.sd_model,
|
||||||
outpath_samples=opts.outdir_samples or opts.outdir_txt2img_samples,
|
outpath_samples=opts.outdir_samples or opts.outdir_txt2img_samples,
|
||||||
|
|
@ -40,22 +40,14 @@ def txt2img(id_task: str, prompt: str, negative_prompt: str, prompt_styles, step
|
||||||
hr_resize_y=hr_resize_y,
|
hr_resize_y=hr_resize_y,
|
||||||
override_settings=override_settings,
|
override_settings=override_settings,
|
||||||
)
|
)
|
||||||
|
|
||||||
p.scripts = modules.scripts.scripts_txt2img
|
p.scripts = modules.scripts.scripts_txt2img
|
||||||
p.script_args = args
|
p.script_args = args
|
||||||
|
|
||||||
processed = modules.scripts.scripts_txt2img.run(p, *args)
|
processed = modules.scripts.scripts_txt2img.run(p, *args)
|
||||||
|
|
||||||
if processed is None:
|
if processed is None:
|
||||||
processed = process_images(p)
|
processed = process_images(p)
|
||||||
|
|
||||||
p.close()
|
p.close()
|
||||||
|
|
||||||
shared.total_tqdm.clear()
|
shared.total_tqdm.clear()
|
||||||
|
|
||||||
generation_info_js = processed.js()
|
generation_info_js = processed.js()
|
||||||
|
|
||||||
if opts.do_not_show_images:
|
if opts.do_not_show_images:
|
||||||
processed.images = []
|
processed.images = []
|
||||||
|
|
||||||
return processed.images, generation_info_js, plaintext_to_html(processed.info), plaintext_to_html(processed.comments)
|
return processed.images, generation_info_js, plaintext_to_html(processed.info), plaintext_to_html(processed.comments)
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,10 @@ def apply_and_restart(disable_list, update_list, disable_all):
|
||||||
shared.opts.disable_all_extensions = disable_all
|
shared.opts.disable_all_extensions = disable_all
|
||||||
shared.opts.save(shared.config_filename)
|
shared.opts.save(shared.config_filename)
|
||||||
|
|
||||||
shared.state.interrupt()
|
# shared.state.interrupt()
|
||||||
shared.state.need_restart = True
|
# shared.state.need_restart = True
|
||||||
shared.restart_server()
|
# shared.restart_server()
|
||||||
|
print('Extension list updated - please restart the server')
|
||||||
|
|
||||||
|
|
||||||
def check_updates(_id_task, disable_list):
|
def check_updates(_id_task, disable_list):
|
||||||
|
|
@ -292,7 +293,7 @@ def create_ui():
|
||||||
with gr.TabItem("Installed"):
|
with gr.TabItem("Installed"):
|
||||||
|
|
||||||
with gr.Row(elem_id="extensions_installed_top"):
|
with gr.Row(elem_id="extensions_installed_top"):
|
||||||
apply = gr.Button(value="Apply & restart UI", variant="primary")
|
apply = gr.Button(value="Apply (restart required)", variant="primary")
|
||||||
check = gr.Button(value="Check for updates")
|
check = gr.Button(value="Check for updates")
|
||||||
extensions_disable_all = gr.Radio(label="Disable all extensions", choices=["none", "extra", "all"], value=shared.opts.disable_all_extensions, elem_id="extensions_disable_all")
|
extensions_disable_all = gr.Radio(label="Disable all extensions", choices=["none", "extra", "all"], value=shared.opts.disable_all_extensions, elem_id="extensions_disable_all")
|
||||||
extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False)
|
extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False)
|
||||||
|
|
|
||||||
7
setup.py
7
setup.py
|
|
@ -135,14 +135,13 @@ def update(folder):
|
||||||
return
|
return
|
||||||
branch = git('branch', folder)
|
branch = git('branch', folder)
|
||||||
if 'main' in branch:
|
if 'main' in branch:
|
||||||
git('checkout main', folder)
|
|
||||||
branch = 'main'
|
branch = 'main'
|
||||||
elif 'master' in branch:
|
elif 'master' in branch:
|
||||||
git('checkout master', folder)
|
|
||||||
branch = 'master'
|
branch = 'master'
|
||||||
else:
|
else:
|
||||||
log.warning(f'Unknown branch for: {folder}')
|
branch = branch.split('\n')[0].replace('*', '').strip()
|
||||||
branch = None
|
log.debug(f'Setting branch: {folder} / {branch}')
|
||||||
|
git(f'checkout {branch}', folder)
|
||||||
if branch is None:
|
if branch is None:
|
||||||
git('pull --autostash --rebase', folder)
|
git('pull --autostash --rebase', folder)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue