Bug fix: Annotation results were not mapped correctly to session g_generation_session.controlNetMask.
parent
762ea30ce4
commit
8434075182
|
|
@ -635,6 +635,7 @@ async function requestControlNetTxt2Img(plugin_settings) {
|
|||
const base64_mask = json['images'].slice(numOfImages - numberOfAnnotations)
|
||||
|
||||
let mask_index = 0
|
||||
|
||||
for (let index = 0; index < control_networks.length; index++) {
|
||||
if (
|
||||
control_networks[index] == false ||
|
||||
|
|
@ -645,9 +646,10 @@ async function requestControlNetTxt2Img(plugin_settings) {
|
|||
base64ToBase64Url(base64_mask[mask_index]),
|
||||
index
|
||||
)
|
||||
g_generation_session.controlNetMask[index] = base64_mask[mask_index]
|
||||
mask_index++
|
||||
}
|
||||
g_generation_session.controlNetMask = base64_mask
|
||||
// g_generation_session.controlNetMask = base64_mask
|
||||
|
||||
const standard_response = await py_re.convertToStandardResponse(
|
||||
control_net_settings,
|
||||
|
|
@ -669,14 +671,18 @@ async function requestControlNetImg2Img(plugin_settings) {
|
|||
const control_net_settings =
|
||||
control_net.mapPluginSettingsToControlNet(plugin_settings)
|
||||
|
||||
let control_networks = 0
|
||||
// let control_networks = 0
|
||||
let control_networks = []
|
||||
for (
|
||||
let index = 0;
|
||||
index < control_net.getControlNetMaxModelsNumber();
|
||||
index++
|
||||
) {
|
||||
if (!control_net.getEnableControlNet(index)) break
|
||||
control_networks++
|
||||
if (!control_net.getEnableControlNet(index)) {
|
||||
control_networks[index] = false
|
||||
continue
|
||||
}
|
||||
control_networks[index] = true
|
||||
if (!control_net_settings['controlnet_units'][index]['input_image']) {
|
||||
app.showAlert('you need to add a valid ControlNet input image')
|
||||
throw 'you need to add a valid ControlNet input image'
|
||||
|
|
@ -707,20 +713,32 @@ async function requestControlNetImg2Img(plugin_settings) {
|
|||
|
||||
//update the mask in controlNet tab
|
||||
const numOfImages = json['images'].length
|
||||
const base64_mask = json['images'].slice(numOfImages - control_networks)
|
||||
let numberOfAnnotations =
|
||||
numOfImages - g_generation_session.last_settings.batch_size
|
||||
if (numberOfAnnotations < 0) numberOfAnnotations = 0
|
||||
|
||||
for (let index = 0; index < control_networks; index++) {
|
||||
const base64_mask = json['images'].slice(numOfImages - numberOfAnnotations)
|
||||
|
||||
let mask_index = 0
|
||||
for (let index = 0; index < control_networks.length; index++) {
|
||||
if (
|
||||
control_networks[index] == false ||
|
||||
mask_index >= numberOfAnnotations
|
||||
)
|
||||
continue
|
||||
html_manip.setControlMaskSrc(
|
||||
base64ToBase64Url(base64_mask[index]),
|
||||
base64ToBase64Url(base64_mask[mask_index]),
|
||||
index
|
||||
)
|
||||
g_generation_session.controlNetMask[index] = base64_mask[mask_index]
|
||||
mask_index++
|
||||
}
|
||||
|
||||
g_generation_session.controlNetMask = base64_mask
|
||||
// g_generation_session.controlNetMask = base64_mask
|
||||
|
||||
const standard_response = await py_re.convertToStandardResponse(
|
||||
control_net_settings,
|
||||
json['images'].slice(0, numOfImages - control_networks),
|
||||
json['images'].slice(0, numOfImages - numberOfAnnotations),
|
||||
plugin_settings['uniqueDocumentId']
|
||||
)
|
||||
console.log('standard_response:', standard_response)
|
||||
|
|
|
|||
Loading…
Reference in New Issue