mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-01-13 09:48:26 +01:00
Show controlnet preview in the task entry after applying the filter
This commit is contained in:
parent
8dafe486a2
commit
38b2eec4be
@ -1446,12 +1446,12 @@ function createTask(task) {
|
|||||||
if (task.reqBody.init_image !== undefined) {
|
if (task.reqBody.init_image !== undefined) {
|
||||||
let h = 80
|
let h = 80
|
||||||
let w = ((task.reqBody.width * h) / task.reqBody.height) >> 0
|
let w = ((task.reqBody.width * h) / task.reqBody.height) >> 0
|
||||||
taskConfig += `<div class="task-initimg" style="float:left;"><img style="width:${w}px;height:${h}px;" src="${task.reqBody.init_image}"><div class="task-fs-initimage"></div></div>`
|
taskConfig += `<div class="task-initimg init-img-preview" style="float:left;"><img style="width:${w}px;height:${h}px;" src="${task.reqBody.init_image}"><div class="task-fs-initimage"></div></div>`
|
||||||
}
|
}
|
||||||
if (task.reqBody.control_image !== undefined) {
|
if (task.reqBody.control_image !== undefined) {
|
||||||
let h = 80
|
let h = 80
|
||||||
let w = ((task.reqBody.width * h) / task.reqBody.height) >> 0
|
let w = ((task.reqBody.width * h) / task.reqBody.height) >> 0
|
||||||
taskConfig += `<div class="task-initimg" style="float:left;"><img style="width:${w}px;height:${h}px;" src="${task.reqBody.control_image}"><div class="task-fs-initimage"></div></div>`
|
taskConfig += `<div class="task-initimg controlnet-img-preview" style="float:left;"><img style="width:${w}px;height:${h}px;" src="${task.reqBody.control_image}"><div class="task-fs-initimage"></div></div>`
|
||||||
}
|
}
|
||||||
|
|
||||||
taskConfig += `<div class="taskConfigData">${createTaskConfig(task)}</span></div></div>`
|
taskConfig += `<div class="taskConfigData">${createTaskConfig(task)}</span></div></div>`
|
||||||
@ -1473,6 +1473,30 @@ function createTask(task) {
|
|||||||
<div class="img-preview">
|
<div class="img-preview">
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
|
if (task.reqBody.init_image !== undefined || task.reqBody.control_image !== undefined) {
|
||||||
|
createInitImageHover(taskEntry)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task.reqBody.control_image !== undefined && task.reqBody.control_filter_to_apply !== undefined) {
|
||||||
|
let controlImagePreview = taskEntry.querySelector(".controlnet-img-preview > img")
|
||||||
|
let req = {
|
||||||
|
image: task.reqBody.control_image,
|
||||||
|
filter: task.reqBody.control_filter_to_apply,
|
||||||
|
model_paths: {},
|
||||||
|
filter_params: {},
|
||||||
|
}
|
||||||
|
req["model_paths"][task.reqBody.control_filter_to_apply] = task.reqBody.control_filter_to_apply
|
||||||
|
SD.filter(req).then(
|
||||||
|
(result) => {
|
||||||
|
console.log(result)
|
||||||
|
controlImagePreview.src = result.output[0]
|
||||||
|
let controlImageLargePreview = taskEntry.querySelector(".controlnet-img-preview .task-fs-initimage img")
|
||||||
|
controlImageLargePreview.src = controlImagePreview.src
|
||||||
|
},
|
||||||
|
(error) => console.log("filter error", error)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
createCollapsibles(taskEntry)
|
createCollapsibles(taskEntry)
|
||||||
|
|
||||||
let draghandle = taskEntry.querySelector(".drag-handle")
|
let draghandle = taskEntry.querySelector(".drag-handle")
|
||||||
@ -1503,10 +1527,6 @@ function createTask(task) {
|
|||||||
startY = e.target.closest(".imageTaskContainer").offsetTop
|
startY = e.target.closest(".imageTaskContainer").offsetTop
|
||||||
})
|
})
|
||||||
|
|
||||||
if (task.reqBody.init_image !== undefined || task.reqBody.control_image !== undefined) {
|
|
||||||
createInitImageHover(taskEntry)
|
|
||||||
}
|
|
||||||
|
|
||||||
task["taskStatusLabel"] = taskEntry.querySelector(".taskStatusLabel")
|
task["taskStatusLabel"] = taskEntry.querySelector(".taskStatusLabel")
|
||||||
task["outputContainer"] = taskEntry.querySelector(".img-preview")
|
task["outputContainer"] = taskEntry.querySelector(".img-preview")
|
||||||
task["outputMsg"] = taskEntry.querySelector(".outputMsg")
|
task["outputMsg"] = taskEntry.querySelector(".outputMsg")
|
||||||
|
Loading…
Reference in New Issue
Block a user