Merge pull request #5977 from philpax/api-dont-save-extras-output
fix(api): don't save extras output to disk
This commit is contained in:
commit
5927d3fa95
2 changed files with 12 additions and 11 deletions
|
@ -181,7 +181,7 @@ class Api:
|
||||||
reqDict['image'] = decode_base64_to_image(reqDict['image'])
|
reqDict['image'] = decode_base64_to_image(reqDict['image'])
|
||||||
|
|
||||||
with self.queue_lock:
|
with self.queue_lock:
|
||||||
result = run_extras(extras_mode=0, image_folder="", input_dir="", output_dir="", **reqDict)
|
result = run_extras(extras_mode=0, image_folder="", input_dir="", output_dir="", save_output=False, **reqDict)
|
||||||
|
|
||||||
return ExtrasSingleImageResponse(image=encode_pil_to_base64(result[0][0]), html_info=result[1])
|
return ExtrasSingleImageResponse(image=encode_pil_to_base64(result[0][0]), html_info=result[1])
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class Api:
|
||||||
reqDict.pop('imageList')
|
reqDict.pop('imageList')
|
||||||
|
|
||||||
with self.queue_lock:
|
with self.queue_lock:
|
||||||
result = run_extras(extras_mode=1, image="", input_dir="", output_dir="", **reqDict)
|
result = run_extras(extras_mode=1, image="", input_dir="", output_dir="", save_output=False, **reqDict)
|
||||||
|
|
||||||
return ExtrasBatchImagesResponse(images=list(map(encode_pil_to_base64, result[0])), html_info=result[1])
|
return ExtrasBatchImagesResponse(images=list(map(encode_pil_to_base64, result[0])), html_info=result[1])
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class LruCache(OrderedDict):
|
||||||
cached_images: LruCache = LruCache(max_size=5)
|
cached_images: LruCache = LruCache(max_size=5)
|
||||||
|
|
||||||
|
|
||||||
def run_extras(extras_mode, resize_mode, image, image_folder, input_dir, output_dir, show_extras_results, gfpgan_visibility, codeformer_visibility, codeformer_weight, upscaling_resize, upscaling_resize_w, upscaling_resize_h, upscaling_crop, extras_upscaler_1, extras_upscaler_2, extras_upscaler_2_visibility, upscale_first: bool):
|
def run_extras(extras_mode, resize_mode, image, image_folder, input_dir, output_dir, show_extras_results, gfpgan_visibility, codeformer_visibility, codeformer_weight, upscaling_resize, upscaling_resize_w, upscaling_resize_h, upscaling_crop, extras_upscaler_1, extras_upscaler_2, extras_upscaler_2_visibility, upscale_first: bool, save_output: bool = True):
|
||||||
devices.torch_gc()
|
devices.torch_gc()
|
||||||
|
|
||||||
imageArr = []
|
imageArr = []
|
||||||
|
@ -193,6 +193,7 @@ def run_extras(extras_mode, resize_mode, image, image_folder, input_dir, output_
|
||||||
else:
|
else:
|
||||||
basename = ''
|
basename = ''
|
||||||
|
|
||||||
|
if save_output:
|
||||||
# Add upscaler name as a suffix.
|
# Add upscaler name as a suffix.
|
||||||
suffix = f"-{shared.sd_upscalers[extras_upscaler_1].name}" if shared.opts.use_upscaler_name_as_suffix else ""
|
suffix = f"-{shared.sd_upscalers[extras_upscaler_1].name}" if shared.opts.use_upscaler_name_as_suffix else ""
|
||||||
# Add second upscaler if applicable.
|
# Add second upscaler if applicable.
|
||||||
|
|
Loading…
Reference in a new issue