partial revert to fix compatible issue (#1892)
* partial revert to fix A1111 compatible issue * fix for submit_extras()
This commit is contained in:
+23
-8
@@ -113,6 +113,21 @@ function get_img2img_tab_index() {
|
|||||||
function create_submit_args(args) {
|
function create_submit_args(args) {
|
||||||
var res = Array.from(args);
|
var res = Array.from(args);
|
||||||
|
|
||||||
|
// As it is currently, txt2img and img2img send back the previous output args (txt2img_gallery, generation_info, html_info) whenever you generate a new image.
|
||||||
|
// This can lead to uploading a huge gallery of previously generated images, which leads to an unnecessary delay between submitting and beginning to generate.
|
||||||
|
// I don't know why gradio is sending outputs along with inputs, but we can prevent sending the image gallery here, which seems to be an issue for some.
|
||||||
|
|
||||||
|
// If gradio at some point stops sending outputs, this may break something
|
||||||
|
if (Array.isArray(res[res.length - 4])) {
|
||||||
|
//res[res.length - 4] = null;
|
||||||
|
// simply drop output args
|
||||||
|
res = res.slice(0, res.length - 4);
|
||||||
|
} else if (Array.isArray(res[res.length - 3])) {
|
||||||
|
// for submit_extras()
|
||||||
|
//res[res.length - 3] = null;
|
||||||
|
res = res.slice(0, res.length - 3);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +151,7 @@ function showRestoreProgressButton(tabname, show) {
|
|||||||
button.style.setProperty('display', show ? 'flex' : 'none', 'important');
|
button.style.setProperty('display', show ? 'flex' : 'none', 'important');
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit(args) {
|
function submit() {
|
||||||
showSubmitButtons('txt2img', false);
|
showSubmitButtons('txt2img', false);
|
||||||
|
|
||||||
var id = randomId();
|
var id = randomId();
|
||||||
@@ -148,22 +163,22 @@ function submit(args) {
|
|||||||
showRestoreProgressButton('txt2img', false);
|
showRestoreProgressButton('txt2img', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
var res = create_submit_args(args);
|
var res = create_submit_args(arguments);
|
||||||
|
|
||||||
res[0] = id;
|
res[0] = id;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit_txt2img_upscale(args) {
|
function submit_txt2img_upscale() {
|
||||||
var res = submit(args);
|
var res = submit(...arguments);
|
||||||
|
|
||||||
res[2] = selected_gallery_index();
|
res[2] = selected_gallery_index();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit_img2img(args) {
|
function submit_img2img() {
|
||||||
showSubmitButtons('img2img', false);
|
showSubmitButtons('img2img', false);
|
||||||
|
|
||||||
var id = randomId();
|
var id = randomId();
|
||||||
@@ -175,14 +190,14 @@ function submit_img2img(args) {
|
|||||||
showRestoreProgressButton('img2img', false);
|
showRestoreProgressButton('img2img', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
var res = create_submit_args(args);
|
var res = create_submit_args(arguments);
|
||||||
|
|
||||||
res[0] = id;
|
res[0] = id;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit_extras(args) {
|
function submit_extras() {
|
||||||
showSubmitButtons('extras', false);
|
showSubmitButtons('extras', false);
|
||||||
|
|
||||||
var id = randomId();
|
var id = randomId();
|
||||||
@@ -191,7 +206,7 @@ function submit_extras(args) {
|
|||||||
showSubmitButtons('extras', true);
|
showSubmitButtons('extras', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
var res = create_submit_args(args);
|
var res = create_submit_args(arguments);
|
||||||
|
|
||||||
res[0] = id;
|
res[0] = id;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -440,7 +440,7 @@ def create_ui():
|
|||||||
|
|
||||||
txt2img_args = dict(
|
txt2img_args = dict(
|
||||||
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img, extra_outputs=[None, '', '']),
|
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img, extra_outputs=[None, '', '']),
|
||||||
js=f"(...args) => {{ return submit(args.slice(0, {len(txt2img_inputs)})); }}",
|
_js="submit",
|
||||||
inputs=txt2img_inputs,
|
inputs=txt2img_inputs,
|
||||||
outputs=txt2img_outputs,
|
outputs=txt2img_outputs,
|
||||||
show_progress=False,
|
show_progress=False,
|
||||||
@@ -452,7 +452,7 @@ def create_ui():
|
|||||||
txt2img_upscale_inputs = txt2img_inputs[0:1] + [output_panel.gallery, dummy_component_number, output_panel.generation_info] + txt2img_inputs[1:]
|
txt2img_upscale_inputs = txt2img_inputs[0:1] + [output_panel.gallery, dummy_component_number, output_panel.generation_info] + txt2img_inputs[1:]
|
||||||
output_panel.button_upscale.click(
|
output_panel.button_upscale.click(
|
||||||
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img_upscale, extra_outputs=[None, '', '']),
|
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img_upscale, extra_outputs=[None, '', '']),
|
||||||
js=f"(...args) => {{ return submit_txt2img_upscale(args.slice(0, {len(txt2img_upscale_inputs)})); }}",
|
_js="submit_txt2img_upscale",
|
||||||
inputs=txt2img_upscale_inputs,
|
inputs=txt2img_upscale_inputs,
|
||||||
outputs=txt2img_outputs,
|
outputs=txt2img_outputs,
|
||||||
show_progress=False,
|
show_progress=False,
|
||||||
@@ -790,7 +790,7 @@ def create_ui():
|
|||||||
|
|
||||||
img2img_args = dict(
|
img2img_args = dict(
|
||||||
fn=wrap_gradio_gpu_call(modules.img2img.img2img, extra_outputs=[None, '', '']),
|
fn=wrap_gradio_gpu_call(modules.img2img.img2img, extra_outputs=[None, '', '']),
|
||||||
js=f"(...args) => {{ return submit_img2img(args.slice(0, {len(submit_img2img_inputs)})); }}",
|
_js="submit_img2img",
|
||||||
inputs=submit_img2img_inputs,
|
inputs=submit_img2img_inputs,
|
||||||
outputs=[
|
outputs=[
|
||||||
output_panel.gallery,
|
output_panel.gallery,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ def create_ui():
|
|||||||
|
|
||||||
submit.click(
|
submit.click(
|
||||||
fn=call_queue.wrap_gradio_gpu_call(postprocessing.run_postprocessing_webui, extra_outputs=[None, '']),
|
fn=call_queue.wrap_gradio_gpu_call(postprocessing.run_postprocessing_webui, extra_outputs=[None, '']),
|
||||||
js=f"(...args) => {{ return submit_extras(args.slice(0, {len(submit_click_inputs)})); }}",
|
_js=f"submit_extras",
|
||||||
inputs=submit_click_inputs,
|
inputs=submit_click_inputs,
|
||||||
outputs=[
|
outputs=[
|
||||||
output_panel.gallery,
|
output_panel.gallery,
|
||||||
|
|||||||
Reference in New Issue
Block a user