mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-20 18:08:00 +02:00
Simplify onUpscaleClick (#602)
* Simplified onUpscaleClick code. * Updated fix with comment as to what it's fixing. * Move the fix to enqueueImageVariationTask
This commit is contained in:
parent
bd10a850fa
commit
f701b8dc29
@ -375,11 +375,21 @@ function onMakeSimilarClick(req, img) {
|
|||||||
function enqueueImageVariationTask(req, img, reqDiff) {
|
function enqueueImageVariationTask(req, img, reqDiff) {
|
||||||
const imageSeed = img.getAttribute('data-seed')
|
const imageSeed = img.getAttribute('data-seed')
|
||||||
|
|
||||||
const newTaskRequest = modifyCurrentRequest(req, reqDiff, {
|
const newRequestBody = {
|
||||||
num_outputs: 1, // this can be user-configurable in the future
|
num_outputs: 1, // this can be user-configurable in the future
|
||||||
seed: imageSeed
|
seed: imageSeed
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// If the user is editing pictures, stop modifyCurrentRequest from importing
|
||||||
|
// new values by setting the missing properties to undefined
|
||||||
|
if (!('init_image' in req) && !('init_image' in reqDiff)) {
|
||||||
|
newRequestBody.init_image = undefined
|
||||||
|
newRequestBody.mask = undefined
|
||||||
|
} else if (!('mask' in req) && !('mask' in reqDiff)) {
|
||||||
|
newRequestBody.mask = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const newTaskRequest = modifyCurrentRequest(req, reqDiff, newRequestBody)
|
||||||
newTaskRequest.numOutputsTotal = 1 // this can be user-configurable in the future
|
newTaskRequest.numOutputsTotal = 1 // this can be user-configurable in the future
|
||||||
newTaskRequest.batchCount = 1
|
newTaskRequest.batchCount = 1
|
||||||
|
|
||||||
@ -387,29 +397,10 @@ function enqueueImageVariationTask(req, img, reqDiff) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onUpscaleClick(req, img) {
|
function onUpscaleClick(req, img) {
|
||||||
if (IMAGE_REGEX.test(req.init_image) && IMAGE_REGEX.test(req.mask)) {
|
|
||||||
enqueueImageVariationTask(req, img, {
|
enqueueImageVariationTask(req, img, {
|
||||||
use_upscale: upscaleModelField.value,
|
use_upscale: upscaleModelField.value
|
||||||
init_image: req.init_image,
|
|
||||||
mask: req.mask
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (IMAGE_REGEX.test(req.init_image)) {
|
|
||||||
enqueueImageVariationTask(req, img, {
|
|
||||||
use_upscale: upscaleModelField.value,
|
|
||||||
init_image: req.init_image,
|
|
||||||
mask: undefined
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
enqueueImageVariationTask(req, img, {
|
|
||||||
use_upscale: upscaleModelField.value,
|
|
||||||
init_image: undefined,
|
|
||||||
mask: undefined
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onFixFacesClick(req, img) {
|
function onFixFacesClick(req, img) {
|
||||||
enqueueImageVariationTask(req, img, {
|
enqueueImageVariationTask(req, img, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user