diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-01-26 20:29:27 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-01-26 20:31:32 +0000 |
commit | 7a14c8ab45da8a681792a6331d48a88dd684a0a9 (patch) | |
tree | e69e23e824ac24c544e0b236367e20742a44a11e /scripts/postprocessing_upscale.py | |
parent | 645f4e7ef8c9d59deea7091a22373b2da2b780f2 (diff) | |
download | stable-diffusion-webui-gfx803-7a14c8ab45da8a681792a6331d48a88dd684a0a9.tar.gz stable-diffusion-webui-gfx803-7a14c8ab45da8a681792a6331d48a88dd684a0a9.tar.bz2 stable-diffusion-webui-gfx803-7a14c8ab45da8a681792a6331d48a88dd684a0a9.zip |
add an option to enable sections from extras tab in txt2img/img2img
fix some style inconsistenices
Diffstat (limited to 'scripts/postprocessing_upscale.py')
-rw-r--r-- | scripts/postprocessing_upscale.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/postprocessing_upscale.py b/scripts/postprocessing_upscale.py index 095d29b2..8842bd91 100644 --- a/scripts/postprocessing_upscale.py +++ b/scripts/postprocessing_upscale.py @@ -104,3 +104,28 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing): def image_changed(self):
upscale_cache.clear()
+
+
+class ScriptPostprocessingUpscaleSimple(ScriptPostprocessingUpscale):
+ name = "Simple Upscale"
+ order = 900
+
+ def ui(self):
+ with FormRow():
+ upscaler_name = gr.Dropdown(label='Upscaler', choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name)
+ upscale_by = gr.Slider(minimum=0.05, maximum=8.0, step=0.05, label="Upscale by", value=2)
+
+ return {
+ "upscale_by": upscale_by,
+ "upscaler_name": upscaler_name,
+ }
+
+ def process(self, pp: scripts_postprocessing.PostprocessedImage, upscale_by=2.0, upscaler_name=None):
+ if upscaler_name is None or upscaler_name == "None":
+ return
+
+ upscaler1 = next(iter([x for x in shared.sd_upscalers if x.name == upscaler_name]), None)
+ assert upscaler1, f'could not find upscaler named {upscaler_name}'
+
+ pp.image = self.upscale(pp.image, pp.info, upscaler1, 0, upscale_by, 0, 0, False)
+ pp.info[f"Postprocess upscaler"] = upscaler1.name
|