make it possible to use fractional values for SD upscale.
This commit is contained in:
parent
ef27a18b6b
commit
4dbde228ff
|
@ -53,10 +53,10 @@ class Upscaler:
|
||||||
def do_upscale(self, img: PIL.Image, selected_model: str):
|
def do_upscale(self, img: PIL.Image, selected_model: str):
|
||||||
return img
|
return img
|
||||||
|
|
||||||
def upscale(self, img: PIL.Image, scale: int, selected_model: str = None):
|
def upscale(self, img: PIL.Image, scale, selected_model: str = None):
|
||||||
self.scale = scale
|
self.scale = scale
|
||||||
dest_w = img.width * scale
|
dest_w = int(img.width * scale)
|
||||||
dest_h = img.height * scale
|
dest_h = int(img.height * scale)
|
||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
shape = (img.width, img.height)
|
shape = (img.width, img.height)
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Script(scripts.Script):
|
||||||
def ui(self, is_img2img):
|
def ui(self, is_img2img):
|
||||||
info = gr.HTML("<p style=\"margin-bottom:0.75em\">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>")
|
info = gr.HTML("<p style=\"margin-bottom:0.75em\">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>")
|
||||||
overlap = gr.Slider(minimum=0, maximum=256, step=16, label='Tile overlap', value=64)
|
overlap = gr.Slider(minimum=0, maximum=256, step=16, label='Tile overlap', value=64)
|
||||||
scale_factor = gr.Slider(minimum=1, maximum=4, step=1, label='Scale Factor', value=2)
|
scale_factor = gr.Slider(minimum=1.0, maximum=4.0, step=0.05, label='Scale Factor', value=2.0)
|
||||||
upscaler_index = gr.Radio(label='Upscaler', choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name, type="index")
|
upscaler_index = gr.Radio(label='Upscaler', choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name, type="index")
|
||||||
|
|
||||||
return [info, overlap, upscaler_index, scale_factor]
|
return [info, overlap, upscaler_index, scale_factor]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user