mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-04-01 19:47:35 +02:00
Fix another bug with placeholder images; Move the logic for whether show_only_filtered is applied to the server
This commit is contained in:
parent
bb6db783d8
commit
18f452d968
@ -714,7 +714,6 @@ async function doMakeImage(reqBody, batchCount) {
|
|||||||
let res = ''
|
let res = ''
|
||||||
let seed = reqBody['seed']
|
let seed = reqBody['seed']
|
||||||
let numOutputs = parseInt(reqBody['num_outputs'])
|
let numOutputs = parseInt(reqBody['num_outputs'])
|
||||||
let showOnlyFilteredImage = reqBody['show_only_filtered_image']
|
|
||||||
|
|
||||||
let images = []
|
let images = []
|
||||||
|
|
||||||
@ -843,7 +842,7 @@ async function doMakeImage(reqBody, batchCount) {
|
|||||||
|
|
||||||
lastPromptUsed = reqBody['prompt']
|
lastPromptUsed = reqBody['prompt']
|
||||||
|
|
||||||
makeImageContainers(numOutputs * (showOnlyFilteredImage ? 1 : 2))
|
makeImageContainers(res.output.length)
|
||||||
|
|
||||||
for (let idx in res.output) {
|
for (let idx in res.output) {
|
||||||
let imgBody = ''
|
let imgBody = ''
|
||||||
@ -991,7 +990,8 @@ async function makeImage() {
|
|||||||
use_cpu: useCPUField.checked,
|
use_cpu: useCPUField.checked,
|
||||||
use_full_precision: useFullPrecisionField.checked,
|
use_full_precision: useFullPrecisionField.checked,
|
||||||
stream_progress_updates: true,
|
stream_progress_updates: true,
|
||||||
stream_image_progress: streamImageProgress
|
stream_image_progress: streamImageProgress,
|
||||||
|
show_only_filtered_image: showOnlyFilteredImageField.checked
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IMAGE_REGEX.test(initImagePreview.src)) {
|
if (IMAGE_REGEX.test(initImagePreview.src)) {
|
||||||
@ -1018,10 +1018,6 @@ async function makeImage() {
|
|||||||
reqBody['use_upscale'] = upscaleModelField.value
|
reqBody['use_upscale'] = upscaleModelField.value
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showOnlyFilteredImageField.checked && (useUpscalingField.checked || useFaceCorrectionField.checked)) {
|
|
||||||
reqBody['show_only_filtered_image'] = showOnlyFilteredImageField.checked
|
|
||||||
}
|
|
||||||
|
|
||||||
let time = new Date().getTime()
|
let time = new Date().getTime()
|
||||||
imagesContainer.innerHTML = ''
|
imagesContainer.innerHTML = ''
|
||||||
|
|
||||||
|
@ -399,6 +399,9 @@ def mk_img(req: Request):
|
|||||||
x_sample = x_sample.astype(np.uint8)
|
x_sample = x_sample.astype(np.uint8)
|
||||||
img = Image.fromarray(x_sample)
|
img = Image.fromarray(x_sample)
|
||||||
|
|
||||||
|
has_filters = (opt_use_face_correction is not None and opt_use_face_correction.startswith('GFPGAN')) or \
|
||||||
|
(opt_use_upscale is not None and opt_use_upscale.startswith('RealESRGAN'))
|
||||||
|
|
||||||
if opt_save_to_disk_path is not None:
|
if opt_save_to_disk_path is not None:
|
||||||
prompt_flattened = filename_regex.sub('_', prompts[0])
|
prompt_flattened = filename_regex.sub('_', prompts[0])
|
||||||
prompt_flattened = prompt_flattened[:50]
|
prompt_flattened = prompt_flattened[:50]
|
||||||
@ -409,12 +412,12 @@ def mk_img(req: Request):
|
|||||||
img_out_path = os.path.join(session_out_path, f"{file_path}.{opt_format}")
|
img_out_path = os.path.join(session_out_path, f"{file_path}.{opt_format}")
|
||||||
meta_out_path = os.path.join(session_out_path, f"{file_path}.txt")
|
meta_out_path = os.path.join(session_out_path, f"{file_path}.txt")
|
||||||
|
|
||||||
if not opt_show_only_filtered:
|
if not has_filters or not opt_show_only_filtered:
|
||||||
save_image(img, img_out_path)
|
save_image(img, img_out_path)
|
||||||
|
|
||||||
save_metadata(meta_out_path, prompts, opt_seed, opt_W, opt_H, opt_ddim_steps, opt_scale, opt_strength, opt_use_face_correction, opt_use_upscale)
|
save_metadata(meta_out_path, prompts, opt_seed, opt_W, opt_H, opt_ddim_steps, opt_scale, opt_strength, opt_use_face_correction, opt_use_upscale)
|
||||||
|
|
||||||
if not opt_show_only_filtered:
|
if not has_filters or not opt_show_only_filtered:
|
||||||
img_data = img_to_base64_str(img)
|
img_data = img_to_base64_str(img)
|
||||||
res_image_orig = ResponseImage(data=img_data, seed=opt_seed)
|
res_image_orig = ResponseImage(data=img_data, seed=opt_seed)
|
||||||
res.images.append(res_image_orig)
|
res.images.append(res_image_orig)
|
||||||
@ -422,9 +425,7 @@ def mk_img(req: Request):
|
|||||||
if opt_save_to_disk_path is not None:
|
if opt_save_to_disk_path is not None:
|
||||||
res_image_orig.path_abs = img_out_path
|
res_image_orig.path_abs = img_out_path
|
||||||
|
|
||||||
if (opt_use_face_correction is not None and opt_use_face_correction.startswith('GFPGAN')) or \
|
if has_filters:
|
||||||
(opt_use_upscale is not None and opt_use_upscale.startswith('RealESRGAN')):
|
|
||||||
|
|
||||||
print('Applying filters..')
|
print('Applying filters..')
|
||||||
|
|
||||||
gc()
|
gc()
|
||||||
|
Loading…
Reference in New Issue
Block a user