-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsd-webui-hires-fix-tweaks.py
67 lines (52 loc) · 2.55 KB
/
sd-webui-hires-fix-tweaks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from hires_fix_tweaks.hr_modules import hr_cfg_scale, hr_prompt_mode, hr_batch_seed, hr_output_dir, hr_styles
from hires_fix_tweaks import ui, xyz, settings, checkpoint_tiles_use_short_override # noqa: F401
from modules import scripts, script_callbacks
class HiresFixTweaks(scripts.Script):
def __init__(self):
super().__init__()
self.infotext_fields = []
self.on_after_component_elem_id = []
self.ui_class = ui.UI(self)
self.hr_output_dir = hr_output_dir.HiresOutputDir()
self.hires_cfg_scale = hr_cfg_scale.HiresCFGScale(self)
self.hires_batch_seed = hr_batch_seed.HiresBatchSeed(self)
def title(self):
return 'Hires. fix tweaks'
def show(self, is_img2img):
if not is_img2img:
return scripts.AlwaysVisible
def ui(self, is_img2img):
self.ui_class.fallback_create_ui()
return self.ui_class.ui_args()
def setup(self, p, *args):
self.hr_output_dir.setup(p, *args)
hr_prompt_mode.setup(p, *args)
self.hires_cfg_scale.setup(p, *args)
self.hires_batch_seed.setup(p, *args)
hr_styles.setup(p, *args)
def process(self, p, *args):
self.hires_batch_seed.process(p, *args)
def before_process_batch(self, p, *args, **kwargs):
self.hr_output_dir.before_process_batch(p, *args, **kwargs)
self.hires_batch_seed.before_process_batch(p, *args, **kwargs)
def process_batch(self, p, *args, **kwargs):
self.hires_cfg_scale.process_batch(p, *args, **kwargs)
self.hires_batch_seed.process_batch(p, *args, **kwargs)
def before_hr(self, p, *args):
self.hires_cfg_scale.before_hr(p)
def postprocess_batch(self, p, *args, **kwargs):
self.hr_output_dir.postprocess_batch(p, *args, **kwargs)
self.hires_cfg_scale.postprocess_batch(p)
def postprocess_batch_list(self, p, pp, *args, **kwargs):
self.hires_batch_seed.postprocess_batch_list(p, pp, *args, **kwargs)
def postprocess(self, p, processed, *args):
self.hr_output_dir.postprocess(p, processed, *args)
self.hires_batch_seed.postprocess(p, processed, *args)
hr_batch_seed.hijack_create_infotext(HiresFixTweaks)
script_callbacks.on_infotext_pasted(hr_batch_seed.parse_infotext)
if hr_styles.enable_hr_styles_module:
hr_styles.patch_setup_prompts()
script_callbacks.on_infotext_pasted(hr_styles.parse_infotext)
script_callbacks.on_infotext_pasted(hr_prompt_mode.parse_infotext)
script_callbacks.on_before_ui(xyz.xyz_grid_axis)
checkpoint_tiles_use_short_override.patch_checkpoint_tiles()