mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
refactoring to support control
This commit is contained in:
Submodule extensions-builtin/sd-webui-controlnet updated: 0d0841671e...a13bd2febe
Submodule extensions-builtin/stable-diffusion-webui-images-browser updated: 7301877532...27fe4a713d
@@ -101,9 +101,6 @@ svg.feather.feather-image, .feather .feather-image { display: none }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; }
|
||||
#txt2img_gallery, #img2img_gallery, #extras_gallery { padding: 0; margin: 0; object-fit: contain; box-shadow: none; min-height: 0; }
|
||||
#txt2img_actions_column, #img2img_actions_column { flex-flow: wrap; justify-content: space-between; }
|
||||
#txt2img_enqueue_wrapper, #img2img_enqueue_wrapper { min-width: unset; width: 48%; }
|
||||
#txt2img_generate_box, #img2img_generate_box { min-width: unset; width: 48%; }
|
||||
|
||||
#extras_upscale { margin-top: 10px }
|
||||
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
|
||||
|
||||
@@ -117,9 +117,6 @@ svg.feather.feather-image, .feather .feather-image { display: none }
|
||||
#txt2img_cfg_scale { min-width: 200px; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; }
|
||||
#txt2img_actions_column, #img2img_actions_column { flex-flow: wrap; justify-content: space-between; }
|
||||
#txt2img_enqueue_wrapper, #img2img_enqueue_wrapper { min-width: unset; width: 48%; }
|
||||
#txt2img_generate_box, #img2img_generate_box { min-width: unset; width: 48%; }
|
||||
|
||||
#extras_upscale { margin-top: 10px }
|
||||
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
|
||||
|
||||
@@ -118,11 +118,7 @@ svg.feather.feather-image, .feather .feather-image { display: none }
|
||||
#txt2img_cfg_scale { min-width: 200px; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; }
|
||||
#txt2img_actions_column, #img2img_actions_column { flex-flow: wrap; justify-content: space-between; }
|
||||
#txt2img_enqueue_wrapper, #img2img_enqueue_wrapper { min-width: unset; width: 48%; }
|
||||
#txt2img_generate_box, #img2img_generate_box { min-width: unset; width: 48%; }
|
||||
textarea[rows="1"] { height: 33px !important; width: 99% !important; padding: 8px !important; }
|
||||
|
||||
#extras_upscale { margin-top: 10px }
|
||||
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
|
||||
#txt2img_settings { min-width: var(--left-column); max-width: var(--left-column); background-color: #111111; padding-top: 16px; }
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
const getControlActiveTab = (...args) => {
|
||||
const selectedTab = gradioApp().querySelector('#control-tabs > .tab-nav > .selected');
|
||||
let activeTab = '';
|
||||
if (selectedTab) activeTab = selectedTab.innerText.toLowerCase();
|
||||
args.shift();
|
||||
return [activeTab, ...args];
|
||||
};
|
||||
@@ -16,7 +16,12 @@ const requestGet = (url, data, handler) => {
|
||||
xhr.send(JSON.stringify(data));
|
||||
};
|
||||
|
||||
const getENActiveTab = () => gradioApp().getElementById('tab_txt2img').style.display === 'block' ? 'txt2img' : 'img2img';
|
||||
const getENActiveTab = () => {
|
||||
if (gradioApp().getElementById('tab_txt2img').style.display === 'block') return 'txt2img';
|
||||
if (gradioApp().getElementById('tab_img2img').style.display === 'block') return 'img2img';
|
||||
if (gradioApp().getElementById('tab_control').style.display === 'block') return 'control';
|
||||
return '';
|
||||
};
|
||||
|
||||
const getENActivePage = () => {
|
||||
const tabname = getENActiveTab();
|
||||
@@ -276,9 +281,11 @@ function refreshENpage() {
|
||||
|
||||
// init
|
||||
function setupExtraNetworksForTab(tabname) {
|
||||
gradioApp().querySelector(`#${tabname}_extra_tabs`).classList.add('extra-networks');
|
||||
let tabs = gradioApp().querySelector(`#${tabname}_extra_tabs`);
|
||||
if (tabs) tabs.classList.add('extra-networks');
|
||||
const en = gradioApp().getElementById(`${tabname}_extra_networks`);
|
||||
const tabs = gradioApp().querySelector(`#${tabname}_extra_tabs > div`);
|
||||
tabs = gradioApp().querySelector(`#${tabname}_extra_tabs > div`);
|
||||
if (!tabs) return;
|
||||
|
||||
// buttons
|
||||
const btnRefresh = gradioApp().getElementById(`${tabname}_extra_refresh`);
|
||||
@@ -394,9 +401,11 @@ function setupExtraNetworksForTab(tabname) {
|
||||
function setupExtraNetworks() {
|
||||
setupExtraNetworksForTab('txt2img');
|
||||
setupExtraNetworksForTab('img2img');
|
||||
setupExtraNetworksForTab('control');
|
||||
|
||||
function registerPrompt(tabname, id) {
|
||||
const textarea = gradioApp().querySelector(`#${id} > label > textarea`);
|
||||
if (!textarea) return;
|
||||
if (!activePromptTextarea[tabname]) activePromptTextarea[tabname] = textarea;
|
||||
textarea.addEventListener('focus', () => { activePromptTextarea[tabname] = textarea; });
|
||||
}
|
||||
@@ -405,6 +414,8 @@ function setupExtraNetworks() {
|
||||
registerPrompt('txt2img', 'txt2img_neg_prompt');
|
||||
registerPrompt('img2img', 'img2img_prompt');
|
||||
registerPrompt('img2img', 'img2img_neg_prompt');
|
||||
registerPrompt('control', 'control_prompt');
|
||||
registerPrompt('control', 'control_neg_prompt');
|
||||
log('initExtraNetworks');
|
||||
}
|
||||
|
||||
|
||||
@@ -113,9 +113,6 @@ button.selected {background: var(--button-primary-background-fill);}
|
||||
#txt2img_cfg_scale { min-width: 200px; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; }
|
||||
#txt2img_actions_column, #img2img_actions_column { flex-flow: wrap; justify-content: space-between; }
|
||||
#txt2img_enqueue_wrapper, #img2img_enqueue_wrapper { min-width: unset; width: 48%; }
|
||||
#txt2img_generate_box, #img2img_generate_box { min-width: unset; width: 48%; }
|
||||
|
||||
#extras_upscale { margin-top: 10px }
|
||||
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
|
||||
|
||||
@@ -115,9 +115,6 @@ svg.feather.feather-image, .feather .feather-image { display: none }
|
||||
#txt2img_cfg_scale { min-width: 200px; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; }
|
||||
#txt2img_actions_column, #img2img_actions_column { flex-flow: wrap; justify-content: space-between; }
|
||||
#txt2img_enqueue_wrapper, #img2img_enqueue_wrapper { min-width: unset; width: 48%; }
|
||||
#txt2img_generate_box, #img2img_generate_box { min-width: unset; width: 48%; }
|
||||
|
||||
#extras_upscale { margin-top: 10px }
|
||||
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
|
||||
|
||||
@@ -106,10 +106,6 @@ svg.feather.feather-image, .feather .feather-image { display: none }
|
||||
#txt2img_cfg_scale { min-width: 200px; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; }
|
||||
#txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; }
|
||||
#txt2img_actions_column, #img2img_actions_column { flex-flow: wrap; justify-content: space-between; }
|
||||
#txt2img_enqueue_wrapper, #img2img_enqueue_wrapper { min-width: unset; width: 48%; }
|
||||
#txt2img_generate_box, #img2img_generate_box { min-width: unset; width: 48%; }
|
||||
|
||||
#extras_upscale { margin-top: 10px }
|
||||
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
|
||||
#txt2img_settings { min-width: var(--left-column); max-width: var(--left-column); background-color: #111111; padding-top: 16px; }
|
||||
|
||||
@@ -36,4 +36,6 @@ onAfterUiUpdate(() => {
|
||||
setupBracketChecking('txt2img_neg_prompt', 'txt2img_negative_token_counter');
|
||||
setupBracketChecking('img2img_prompt', 'img2img_token_counter');
|
||||
setupBracketChecking('img2img_neg_prompt', 'img2img_negative_token_counter');
|
||||
setupBracketChecking('control_prompt', 'control_token_counter');
|
||||
setupBracketChecking('control_neg_prompt', 'control_negative_token_counter');
|
||||
});
|
||||
|
||||
+41
-38
@@ -48,7 +48,7 @@ textarea { overflow-y: auto !important; }
|
||||
|
||||
/* custom gradio elements */
|
||||
.accordion-compact { padding: 8px 0px 4px 0px !important; }
|
||||
.settings-accordion > div { flex-flow: wrap; }
|
||||
.settings-accordion>div { flex-flow: wrap; }
|
||||
.small-accordion .form { min-width: var(--left-column) !important; max-width: max-content; }
|
||||
.small-accordion .label-wrap .icon { margin-right: 1.6em; margin-left: 0.6em; color: var(--button-primary-border-color); }
|
||||
.small-accordion .label-wrap { padding: 16px 0px 8px 0px; margin: 0; border-top: 2px solid var(--button-secondary-border-color); }
|
||||
@@ -70,18 +70,21 @@ button.custom-button{ border-radius: var(--button-large-radius); padding: var(--
|
||||
.performance { font-size: 0.85em; color: #444; }
|
||||
.performance p { display: inline-block; color: var(--body-text-color-subdued) !important }
|
||||
.performance .time { margin-right: 0; }
|
||||
#txt2img_prompt_container, #img2img_prompt_container { margin-right: var(--layout-gap) }
|
||||
#txt2img_prompt_container, #img2img_prompt_container, #control_prompt_container { margin-right: var(--layout-gap) }
|
||||
#txt2img_footer, #img2img_footer, #extras_footer { height: fit-content; }
|
||||
#txt2img_footer, #img2img_footer { height: fit-content; display: none; }
|
||||
#txt2img_generate_box, #img2img_generate_box { gap: 0.5em; flex-wrap: wrap-reverse; height: fit-content; }
|
||||
#txt2img_actions_column, #img2img_actions_column { gap: 0.3em; height: fit-content; }
|
||||
#txt2img_generate_box > button, #img2img_generate_box > button, #txt2img_enqueue, #img2img_enqueue { min-height: 42px; max-height: 42px; line-height: 1em; }
|
||||
#txt2img_generate_line2, #img2img_generate_line2, #txt2img_tools, #img2img_tools { display: flex; }
|
||||
#txt2img_generate_line2 > button, #img2img_generate_line2 > button, #extras_generate_box > button, #txt2img_tools > button, #img2img_tools > button { height: 2em; line-height: 0; font-size: var(--input-text-size);
|
||||
#txt2img_generate_box, #img2img_generate_box, #control_general_box { gap: 0.5em; flex-wrap: wrap-reverse; height: fit-content; }
|
||||
#txt2img_actions_column, #img2img_actions_column, #control_actions_column { gap: 0.3em; height: fit-content; }
|
||||
#txt2img_generate_box>button, #img2img_generate_box>button, #control_generate_box>button, #txt2img_enqueue, #img2img_enqueue { min-height: 42px; max-height: 42px; line-height: 1em; }
|
||||
#txt2img_generate_line2, #img2img_generate_line2, #txt2img_tools, #img2img_tools, #control_generate_line2, #control_tools { display: flex; }
|
||||
#txt2img_generate_line2>button, #img2img_generate_line2>button, #extras_generate_box>button, #control_generate_line2>button, #txt2img_tools>button, #img2img_tools>button, #control_tools>button { height: 2em; line-height: 0; font-size: var(--input-text-size);
|
||||
min-width: unset; display: block !important; }
|
||||
#txt2img_prompt, #txt2img_neg_prompt, #img2img_prompt, #img2img_neg_prompt { display: contents; }
|
||||
#txt2img_prompt, #txt2img_neg_prompt, #img2img_prompt, #img2img_neg_prompt, #control_prompt, #control_neg_prompt { display: contents; }
|
||||
#txt2img_generate_box, #img2img_generate_box, #control_generate_box { min-width: unset; width: 48%; }
|
||||
#txt2img_actions_column, #img2img_actions_column, #control_actions { flex-flow: wrap; justify-content: space-between; }
|
||||
#txt2img_enqueue_wrapper, #img2img_enqueue_wrapper, #control_enqueue_wrapper { min-width: unset !important; width: 48%; }
|
||||
.interrogate-col{ min-width: 0 !important; max-width: fit-content; margin-right: var(--spacing-xxl); }
|
||||
.interrogate-col > button{ flex: 1; }
|
||||
.interrogate-col>button{ flex: 1; }
|
||||
#sampler_selection_img2img { margin-top: 1em; }
|
||||
#txtimg_hr_finalres{ min-height: 0 !important; }
|
||||
#img2img_scale_resolution_preview.block{ display: flex; align-items: end; }
|
||||
@@ -91,11 +94,11 @@ div#extras_scale_to_tab div.form{ flex-direction: row; }
|
||||
.inactive{ opacity: 0.5; }
|
||||
div.dimensions-tools { min-width: 0 !important; max-width: fit-content; flex-direction: row; align-content: center; }
|
||||
div#extras_scale_to_tab div.form{ flex-direction: row; }
|
||||
#mode_img2img .gradio-image > div.fixed-height, #mode_img2img .gradio-image > div.fixed-height img{ height: 480px !important; max-height: 480px !important; min-height: 480px !important; }
|
||||
#mode_img2img .gradio-image>div.fixed-height, #mode_img2img .gradio-image>div.fixed-height img{ height: 480px !important; max-height: 480px !important; min-height: 480px !important; }
|
||||
#img2img_sketch, #img2maskimg, #inpaint_sketch { overflow: overlay !important; resize: auto; background: var(--panel-background-fill); z-index: 5; }
|
||||
.image-buttons button{ min-width: auto; }
|
||||
.infotext { overflow-wrap: break-word; line-height: 1.5em; }
|
||||
.infotext > p { padding-left: 1em; text-indent: -1em; white-space: pre-wrap; }
|
||||
.infotext>p { padding-left: 1em; text-indent: -1em; white-space: pre-wrap; }
|
||||
.tooltip { display: block; position: fixed; top: 1em; right: 1em; padding: 0.5em; background: var(--input-background-fill); color: var(--body-text-color); border: 1pt solid var(--button-primary-border-color);
|
||||
width: 22em; min-height: 1.3em; font-size: 0.8em; transition: opacity 0.2s ease-in; pointer-events: none; opacity: 0; z-index: 999; }
|
||||
.tooltip-show { opacity: 0.9; }
|
||||
@@ -104,15 +107,15 @@ div#extras_scale_to_tab div.form{ flex-direction: row; }
|
||||
/* settings */
|
||||
#si-sparkline-memo, #si-sparkline-load { background-color: #111; }
|
||||
#quicksettings { width: fit-content; }
|
||||
#quicksettings > button { padding: 0 1em 0 0; align-self: end; margin-bottom: var(--text-sm); }
|
||||
#quicksettings>button { padding: 0 1em 0 0; align-self: end; margin-bottom: var(--text-sm); }
|
||||
#settings { display: flex; gap: var(--layout-gap); }
|
||||
#settings div { border: none; gap: 0; margin: 0 0 var(--layout-gap) 0px; padding: 0; }
|
||||
#settings > div.tab-content { flex: 10 0 75%; display: grid; }
|
||||
#settings > div.tab-content > div { border: none; padding: 0; }
|
||||
#settings > div.tab-content > div > div > div > div > div { flex-direction: unset; }
|
||||
#settings > div.tab-nav { display: grid; grid-template-columns: repeat(auto-fill, .5em minmax(10em, 1fr)); flex: 1 0 auto; width: 12em; align-self: flex-start; gap: var(--spacing-xxl); }
|
||||
#settings > div.tab-nav button { display: block; border: none; text-align: left; white-space: initial; padding: 0; }
|
||||
#settings > div.tab-nav > #settings_show_all_pages { padding: var(--size-2) var(--size-4); }
|
||||
#settings>div.tab-content { flex: 10 0 75%; display: grid; }
|
||||
#settings>div.tab-content>div { border: none; padding: 0; }
|
||||
#settings>div.tab-content>div>div>div>div>div { flex-direction: unset; }
|
||||
#settings>div.tab-nav { display: grid; grid-template-columns: repeat(auto-fill, .5em minmax(10em, 1fr)); flex: 1 0 auto; width: 12em; align-self: flex-start; gap: var(--spacing-xxl); }
|
||||
#settings>div.tab-nav button { display: block; border: none; text-align: left; white-space: initial; padding: 0; }
|
||||
#settings>div.tab-nav>#settings_show_all_pages { padding: var(--size-2) var(--size-4); }
|
||||
#settings .block.gradio-checkbox { margin: 0; width: auto; }
|
||||
#settings .dirtyable { gap: .5em; }
|
||||
#settings .dirtyable.hidden { display: none; }
|
||||
@@ -146,8 +149,8 @@ div#extras_scale_to_tab div.form{ flex-direction: row; }
|
||||
.modalControls span:hover, .modalControls span:focus { color: var(--highlight-color); filter: none; }
|
||||
.lightboxModalPreviewZone { display: flex; width: 100%; height: 100%; }
|
||||
.lightboxModalPreviewZone:focus-visible { outline: none; }
|
||||
.lightboxModalPreviewZone > img { display: block; margin: auto; width: auto; }
|
||||
.lightboxModalPreviewZone > img.modalImageFullscreen{ object-fit: contain; height: 100%; width: 100%; min-height: 0; background: transparent; }
|
||||
.lightboxModalPreviewZone>img { display: block; margin: auto; width: auto; }
|
||||
.lightboxModalPreviewZone>img.modalImageFullscreen{ object-fit: contain; height: 100%; width: 100%; min-height: 0; background: transparent; }
|
||||
table.settings-value-table { background: white; border-collapse: collapse; margin: 1em; border: var(--spacing-sm) solid white; }
|
||||
table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-width: 36em; }
|
||||
.modalPrev, .modalNext { cursor: pointer; position: relative; z-index: 1; top: 0; width: auto; height: 100vh; line-height: 100vh; text-align: center; padding: 16px;
|
||||
@@ -178,13 +181,13 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
|
||||
#extensions .date{ opacity: 0.85; font-size: 90%; }
|
||||
|
||||
/* extra networks */
|
||||
.extra-networks > div { margin: 0; border-bottom: none !important; gap: 0.3em 0; }
|
||||
.extra-networks>div { margin: 0; border-bottom: none !important; gap: 0.3em 0; }
|
||||
.extra-networks .second-line { display: flex; width: -moz-available; width: -webkit-fill-available; gap: 0.3em; box-shadow: var(--input-shadow); }
|
||||
.extra-networks .search { flex: 1; }
|
||||
.extra-networks .description { flex: 3; }
|
||||
.extra-networks .tab-nav > button { margin-right: 0; height: 24px; padding: 2px 4px 2px 4px; }
|
||||
.extra-networks .tab-nav>button { margin-right: 0; height: 24px; padding: 2px 4px 2px 4px; }
|
||||
.extra-networks .buttons { position: absolute; right: 0; margin: -4px; background: var(--background-color); }
|
||||
.extra-networks .buttons > button { margin-left: -0.2em; height: 1.4em; color: var(--primary-300) !important; }
|
||||
.extra-networks .buttons>button { margin-left: -0.2em; height: 1.4em; color: var(--primary-300) !important; }
|
||||
.extra-networks .custom-button { width: 120px; width: 100%; background: none; justify-content: left; text-align: left; padding: 3px 3px 3px 12px; text-indent: -6px; box-shadow: none; line-break: auto; }
|
||||
.extra-networks .custom-button:hover { background: var(--button-primary-background-fill) }
|
||||
.extra-networks-tab { padding: 0 !important; }
|
||||
@@ -200,18 +203,18 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
|
||||
.extra-network-cards .card:hover .overlay { background: rgba(0, 0, 0, 0.40); }
|
||||
.extra-network-cards .card .overlay .tags { display: none; overflow-wrap: break-word; }
|
||||
.extra-network-cards .card .overlay .tag { padding: 2px; margin: 2px; background: rgba(70, 70, 70, 0.60); font-size: var(--text-md); cursor: pointer; display: inline-block; }
|
||||
.extra-network-cards .card .actions > span { padding: 4px; }
|
||||
.extra-network-cards .card .actions > span:hover { color: var(--highlight-color); }
|
||||
.extra-network-cards .card .actions>span { padding: 4px; }
|
||||
.extra-network-cards .card .actions>span:hover { color: var(--highlight-color); }
|
||||
.extra-network-cards .card:hover .actions { display: block; }
|
||||
.extra-network-cards .card:hover .overlay .tags { display: block; }
|
||||
.extra-network-cards .card .actions { font-size: 3em; display: none; text-align-last: right; cursor: pointer; font-variant: unicase; position: absolute; z-index: 100; right: 0; height: 0.7em; width: 100%; background: rgba(0, 0, 0, 0.40); }
|
||||
.extra-network-cards .card-list { display: flex; margin: 0.3em; padding: 0.3em; background: var(--input-background-fill); cursor: pointer; border-radius: var(--button-large-radius); }
|
||||
.extra-network-cards .card-list .tag { color: var(--primary-500); margin-left: 0.8em; }
|
||||
.extra-details-close { position: fixed; top: 0.2em; right: 0.2em; z-index: 99; background: var(--button-secondary-background-fill) !important; }
|
||||
#txt2img_description, #img2img_description { max-height: 63px; overflow-y: auto !important; }
|
||||
#txt2img_description > label > textarea, #img2img_description > label > textarea { font-size: 0.9em }
|
||||
#txt2img_description, #img2img_description, #control_description { max-height: 63px; overflow-y: auto !important; }
|
||||
#txt2img_description>label>textarea, #img2img_description>label>textarea, #control_description>label>textarea { font-size: 0.9em }
|
||||
|
||||
#txt2img_extra_details > div, #img2img_extra_details > div { overflow-y: auto; min-height: 40vh; max-height: 80vh; align-self: flex-start; }
|
||||
#txt2img_extra_details>div, #img2img_extra_details>div { overflow-y: auto; min-height: 40vh; max-height: 80vh; align-self: flex-start; }
|
||||
#txt2img_extra_details, #img2img_extra_details { position: fixed; bottom: 50%; left: 50%; transform: translate(-50%, 50%); padding: 0.8em; border: var(--block-border-width) solid var(--highlight-color) !important;
|
||||
z-index: 100; box-shadow: var(--button-shadow); }
|
||||
#txt2img_extra_details td:first-child, #img2img_extra_details td:first-child { font-weight: bold; vertical-align: top; }
|
||||
@@ -221,14 +224,14 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
|
||||
/* specific elements */
|
||||
#modelmerger_interp_description { margin-top: 1em; margin-bottom: 1em; }
|
||||
#scripts_alwayson_txt2img, #scripts_alwayson_img2img { padding: 0 }
|
||||
#scripts_alwayson_txt2img > .label-wrap, #scripts_alwayson_img2img > .label-wrap { background: var(--input-background-fill); padding: 0; margin: 0; border-radius: var(--radius-lg); }
|
||||
#scripts_alwayson_txt2img > .label-wrap > span, #scripts_alwayson_img2img > .label-wrap > span { padding: var(--spacing-xxl); }
|
||||
#scripts_alwayson_txt2img>.label-wrap, #scripts_alwayson_img2img>.label-wrap { background: var(--input-background-fill); padding: 0; margin: 0; border-radius: var(--radius-lg); }
|
||||
#scripts_alwayson_txt2img>.label-wrap>span, #scripts_alwayson_img2img>.label-wrap>span { padding: var(--spacing-xxl); }
|
||||
#scripts_alwayson_txt2img div { max-width: var(--left-column); }
|
||||
#script_txt2img_agent_scheduler { display: none; }
|
||||
#refresh_tac_refreshTempFiles { display: none; }
|
||||
#train_tab { flex-flow: row-reverse; }
|
||||
#models_tab { flex-flow: row-reverse; }
|
||||
#swap_axes > button { min-width: 100px; font-size: 1em; }
|
||||
#swap_axes>button { min-width: 100px; font-size: 1em; }
|
||||
#ui_defaults_review { margin: 1em; }
|
||||
|
||||
/* extras */
|
||||
@@ -253,9 +256,9 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
|
||||
|
||||
/* control */
|
||||
.control-button { min-height: 42px; max-height: 42px; line-height: 1em; }
|
||||
.control-tabs > .tab-nav { margin-bottom: 0; margin-top: 0; }
|
||||
.control-tabs>.tab-nav { margin-bottom: 0; margin-top: 0; }
|
||||
.processor-settings { padding: 0 !important; max-width: 300px; }
|
||||
.processor-group > div { flex-flow: wrap;gap: 1em; }
|
||||
.processor-group>div { flex-flow: wrap;gap: 1em; }
|
||||
|
||||
/* loader */
|
||||
.splash { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: block; text-align: center; }
|
||||
@@ -298,22 +301,22 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
|
||||
#txt2img_results, #extras_results, #txt2im g_footer p {text-wrap: wrap; max-width: 100% !important; } /* maintain side by side split on larger mobile displays for from text */
|
||||
}
|
||||
#scripts_alwayson_txt2img div, #scripts_alwayson_img2img div { max-width: 100%; }
|
||||
#txt2img_prompt_container, #img2img_prompt_container { resize:vertical !important; }
|
||||
#txt2img_prompt_container, #img2img_prompt_container, #control_prompt_container { resize:vertical !important; }
|
||||
#txt2img_generate_box, #txt2img_enqueue_wrapper { min-width: 100% !important;} /* make generate and enqueue buttons take up the entire width of their rows. */
|
||||
#img2img_toprow > div.gradio-column {flex-grow: 1 !important;} /*make interrogate buttons take up appropriate space. */
|
||||
#img2img_toprow>div.gradio-column {flex-grow: 1 !important;} /*make interrogate buttons take up appropriate space. */
|
||||
#img2img_actions_column {display: flex; min-width: fit-content !important; flex-direction: row;justify-content: space-evenly; align-items: center;}
|
||||
#txt2img_generate_box, #img2img_generate_box, #txt2img_enqueue_wrapper,#img2img_enqueue_wrapper {display: flex;flex-direction: column;height: 4em !important;align-items: stretch;justify-content: space-evenly;}
|
||||
#img2img_interface, #img2img_results, #img2img_footer p {text-wrap: wrap; min-width: 100% !important; max-width: 100% !important;} /* maintain single column for from image operations on larger mobile devices */
|
||||
#img2img_sketch, #img2maskimg, #inpaint_sketch {display: flex; alignment-baseline:after-edge !important; overflow: auto !important; resize: none !important; } /* fix inpaint image display being too large for mobile displays */
|
||||
#img2maskimg canvas { width: auto !important; max-height: 100% !important; height: auto !important; }
|
||||
#txt2img_sampler, #txt2img_batch, #txt2img_seed_group, #txt2img_advanced, #txt2img_second_pass, #img2img_sampling_group, #img2img_resize_group, #img2img_batch_group, #img2img_seed_group, #img2img_denoise_group, #img2img_advanced_group { width: 100% !important; } /* fix from text/image UI elements to prevent them from moving around within the UI */
|
||||
#img2img_resize_group .gradio-radio > div { display: flex; flex-direction: column; width: unset !important; }
|
||||
#img2img_resize_group .gradio-radio>div { display: flex; flex-direction: column; width: unset !important; }
|
||||
#inpaint_controls div {display:flex;flex-direction: row;}
|
||||
#inpaint_controls .gradio-radio > div { display: flex; flex-direction: column !important; }
|
||||
#inpaint_controls .gradio-radio>div { display: flex; flex-direction: column !important; }
|
||||
#models_tab { flex-direction: column-reverse !important; } /* move image preview/output on models page to bottom of page */
|
||||
#enqueue_keyboard_shortcut_modifiers, #enqueue_keyboard_shortcut_key div { max-width: 40% !important;} /* fix settings for agent scheduler */
|
||||
#settings { display: flex; flex-direction: row; flex-wrap: wrap; max-width: 100% !important; } /* adjust width of certain settings item to allow aligning as row, but not have it go off the screen */
|
||||
#settings div.tab-content > div > div > div { max-width: 80% !important;}
|
||||
#settings div.tab-content>div>div>div { max-width: 80% !important;}
|
||||
#settings div .gradio-radio { width: unset !important; }
|
||||
#tab_extensions table { border-collapse: collapse; display: block; overflow-x:auto !important;} /* enable scrolling on extensions tab */
|
||||
::-webkit-scrollbar { width: 25px !important; height:25px; } /* increase scrollbar size to make it finger friendly */
|
||||
|
||||
@@ -279,6 +279,8 @@ onAfterUiUpdate(async () => {
|
||||
registerTextarea('txt2img_neg_prompt', 'txt2img_negative_token_counter', 'txt2img_negative_token_button');
|
||||
registerTextarea('img2img_prompt', 'img2img_token_counter', 'img2img_token_button');
|
||||
registerTextarea('img2img_neg_prompt', 'img2img_negative_token_counter', 'img2img_negative_token_button');
|
||||
registerTextarea('control_prompt', 'control_token_counter', 'control_token_button');
|
||||
registerTextarea('control_neg_prompt', 'control_negative_token_counter', 'control_negative_token_button');
|
||||
});
|
||||
|
||||
function update_txt2img_tokens(...args) {
|
||||
|
||||
@@ -181,8 +181,19 @@ class StableDiffusionProcessing:
|
||||
self.is_refiner_pass = False
|
||||
self.hr_force = False
|
||||
self.enable_hr = None
|
||||
self.hr_scale = None
|
||||
self.hr_upscaler = None
|
||||
self.hr_resize_x = 0
|
||||
self.hr_resize_y = 0
|
||||
self.hr_upscale_to_x = 0
|
||||
self.hr_upscale_to_y = 0
|
||||
self.truncate_x = 0
|
||||
self.truncate_y = 0
|
||||
self.applied_old_hires_behavior_to = None
|
||||
self.refiner_steps = 5
|
||||
self.refiner_start = 0
|
||||
self.refiner_prompt = ''
|
||||
self.refiner_negative = ''
|
||||
self.ops = []
|
||||
self.resize_mode: int = 0
|
||||
self.ddim_discretize = shared.opts.ddim_discretize
|
||||
|
||||
@@ -458,8 +458,10 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
|
||||
if is_img2img:
|
||||
if use_denoise_start and shared.sd_model_type == 'sdxl':
|
||||
steps = p.steps // (1 - p.refiner_start)
|
||||
else:
|
||||
elif p.denoising_strength > 0:
|
||||
steps = (p.steps // p.denoising_strength) + 1
|
||||
else:
|
||||
steps = p.steps
|
||||
elif use_refiner_start and shared.sd_model_type == 'sdxl':
|
||||
steps = (p.steps // p.refiner_start) + 1
|
||||
else:
|
||||
@@ -472,8 +474,10 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
|
||||
def calculate_hires_steps():
|
||||
if p.hr_second_pass_steps > 0:
|
||||
steps = (p.hr_second_pass_steps // p.denoising_strength) + 1
|
||||
else:
|
||||
elif p.denoising_strength > 0:
|
||||
steps = (p.steps // p.denoising_strength) + 1
|
||||
else:
|
||||
steps = 0
|
||||
|
||||
if os.environ.get('SD_STEPS_DEBUG', None) is not None:
|
||||
shared.log.debug(f'Steps: type=hires input={p.hr_second_pass_steps} output={steps} denoise={p.denoising_strength}')
|
||||
@@ -484,8 +488,10 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
|
||||
if p.refiner_start > 0 and p.refiner_start < 1:
|
||||
#steps = p.refiner_steps // (1 - p.refiner_start) # SDXL with denoise strenght
|
||||
steps = (p.refiner_steps // (1 - p.refiner_start) // 2) + 1
|
||||
else:
|
||||
elif p.denoising_strength > 0:
|
||||
steps = (p.refiner_steps // p.denoising_strength) + 1
|
||||
else:
|
||||
steps = 0
|
||||
else:
|
||||
#steps = p.refiner_steps # SD 1.5 with denoise strenght
|
||||
steps = (p.refiner_steps * 1.25) + 1
|
||||
|
||||
@@ -676,6 +676,18 @@ def detect_pipeline(f: str, op: str = 'model', warning=True):
|
||||
return pipeline, guess
|
||||
|
||||
|
||||
def copy_diffuser_options(new_pipe, orig_pipe):
|
||||
new_pipe.sd_checkpoint_info = orig_pipe.sd_checkpoint_info
|
||||
new_pipe.sd_model_checkpoint = orig_pipe.sd_model_checkpoint
|
||||
new_pipe.sd_model_hash = orig_pipe.sd_model_hash
|
||||
new_pipe.has_accelerate = orig_pipe.has_accelerate
|
||||
new_pipe.embedding_db = orig_pipe.embedding_db
|
||||
new_pipe.is_sdxl = True # pylint: disable=attribute-defined-outside-init # a1111 compatibility item
|
||||
new_pipe.is_sd2 = False # pylint: disable=attribute-defined-outside-init
|
||||
new_pipe.is_sd1 = False # pylint: disable=attribute-defined-outside-init
|
||||
|
||||
|
||||
|
||||
def set_diffuser_options(sd_model, vae = None, op: str = 'model'):
|
||||
if sd_model is None:
|
||||
shared.log.warning(f'{op} is not loaded')
|
||||
|
||||
+63
-58
@@ -46,6 +46,8 @@ apply_style_symbol = symbols.apply
|
||||
save_style_symbol = symbols.save
|
||||
txt2img_paste_fields = []
|
||||
img2img_paste_fields = []
|
||||
txt2img_args = []
|
||||
img2img_args = []
|
||||
|
||||
|
||||
if not cmd_opts.share and not cmd_opts.listen:
|
||||
@@ -491,28 +493,30 @@ def create_ui(startup_timer = None):
|
||||
connect_reuse_seed(seed, reuse_seed, generation_info, dummy_component, is_subseed=False)
|
||||
connect_reuse_seed(subseed, reuse_subseed, generation_info, dummy_component, is_subseed=True)
|
||||
|
||||
txt2img_args = dict(
|
||||
global txt2img_args # pylint: disable=global-statement
|
||||
txt2img_args = [
|
||||
dummy_component,
|
||||
txt2img_prompt, txt2img_negative_prompt,
|
||||
txt2img_prompt_styles,
|
||||
steps,
|
||||
sampler_index, latent_index,
|
||||
full_quality, restore_faces, tiling,
|
||||
batch_count, batch_size,
|
||||
cfg_scale, image_cfg_scale,
|
||||
diffusers_guidance_rescale,
|
||||
clip_skip,
|
||||
seed, subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w,
|
||||
height, width,
|
||||
enable_hr, denoising_strength,
|
||||
hr_scale, hr_upscaler, hr_force, hr_second_pass_steps, hr_resize_x, hr_resize_y,
|
||||
refiner_steps, refiner_start, refiner_prompt, refiner_negative,
|
||||
hdr_clamp, hdr_boundary, hdr_threshold, hdr_center, hdr_channel_shift, hdr_full_shift, hdr_maximize, hdr_max_center, hdr_max_boundry,
|
||||
override_settings,
|
||||
]
|
||||
txt2img_dict = dict(
|
||||
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img, extra_outputs=[None, '', '']),
|
||||
_js="submit_txt2img",
|
||||
inputs=[
|
||||
dummy_component,
|
||||
txt2img_prompt, txt2img_negative_prompt,
|
||||
txt2img_prompt_styles,
|
||||
steps,
|
||||
sampler_index, latent_index,
|
||||
full_quality, restore_faces, tiling,
|
||||
batch_count, batch_size,
|
||||
cfg_scale, image_cfg_scale,
|
||||
diffusers_guidance_rescale,
|
||||
clip_skip,
|
||||
seed, subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w,
|
||||
height, width,
|
||||
enable_hr, denoising_strength,
|
||||
hr_scale, hr_upscaler, hr_force, hr_second_pass_steps, hr_resize_x, hr_resize_y,
|
||||
refiner_steps, refiner_start, refiner_prompt, refiner_negative,
|
||||
hdr_clamp, hdr_boundary, hdr_threshold, hdr_center, hdr_channel_shift, hdr_full_shift, hdr_maximize, hdr_max_center, hdr_max_boundry,
|
||||
override_settings,
|
||||
] + custom_inputs,
|
||||
inputs=txt2img_args + custom_inputs,
|
||||
outputs=[
|
||||
txt2img_gallery,
|
||||
generation_info,
|
||||
@@ -521,8 +525,8 @@ def create_ui(startup_timer = None):
|
||||
],
|
||||
show_progress=False,
|
||||
)
|
||||
txt2img_prompt.submit(**txt2img_args)
|
||||
submit.click(**txt2img_args)
|
||||
txt2img_prompt.submit(**txt2img_dict)
|
||||
submit.click(**txt2img_dict)
|
||||
|
||||
res_switch_btn.click(lambda w, h: (h, w), inputs=[width, height], outputs=[width, height], show_progress=False)
|
||||
batch_switch_btn.click(lambda w, h: (h, w), inputs=[batch_count, batch_size], outputs=[batch_count, batch_size], show_progress=False)
|
||||
@@ -782,42 +786,43 @@ def create_ui(startup_timer = None):
|
||||
img2img_prompt_img
|
||||
]
|
||||
)
|
||||
|
||||
img2img_args = dict(
|
||||
global img2img_args # pylint: disable=global-statement
|
||||
img2img_args = [
|
||||
dummy_component, dummy_component,
|
||||
img2img_prompt, img2img_negative_prompt,
|
||||
img2img_prompt_styles,
|
||||
init_img,
|
||||
sketch,
|
||||
init_img_with_mask,
|
||||
inpaint_color_sketch,
|
||||
inpaint_color_sketch_orig,
|
||||
init_img_inpaint,
|
||||
init_mask_inpaint,
|
||||
steps,
|
||||
sampler_index, latent_index,
|
||||
mask_blur, mask_alpha,
|
||||
inpainting_fill,
|
||||
full_quality, restore_faces, tiling,
|
||||
batch_count, batch_size,
|
||||
cfg_scale, image_cfg_scale,
|
||||
diffusers_guidance_rescale,
|
||||
refiner_steps,
|
||||
refiner_start,
|
||||
clip_skip,
|
||||
denoising_strength,
|
||||
seed, subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w,
|
||||
selected_scale_tab,
|
||||
height, width,
|
||||
scale_by,
|
||||
resize_mode,
|
||||
inpaint_full_res, inpaint_full_res_padding, inpainting_mask_invert,
|
||||
img2img_batch_files, img2img_batch_input_dir, img2img_batch_output_dir, img2img_batch_inpaint_mask_dir,
|
||||
override_settings,
|
||||
]
|
||||
img2img_dict = dict(
|
||||
fn=wrap_gradio_gpu_call(modules.img2img.img2img, extra_outputs=[None, '', '']),
|
||||
_js="submit_img2img",
|
||||
inputs=[
|
||||
dummy_component, dummy_component,
|
||||
img2img_prompt, img2img_negative_prompt,
|
||||
img2img_prompt_styles,
|
||||
init_img,
|
||||
sketch,
|
||||
init_img_with_mask,
|
||||
inpaint_color_sketch,
|
||||
inpaint_color_sketch_orig,
|
||||
init_img_inpaint,
|
||||
init_mask_inpaint,
|
||||
steps,
|
||||
sampler_index, latent_index,
|
||||
mask_blur, mask_alpha,
|
||||
inpainting_fill,
|
||||
full_quality, restore_faces, tiling,
|
||||
batch_count, batch_size,
|
||||
cfg_scale, image_cfg_scale,
|
||||
diffusers_guidance_rescale,
|
||||
refiner_steps,
|
||||
refiner_start,
|
||||
clip_skip,
|
||||
denoising_strength,
|
||||
seed, subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w,
|
||||
selected_scale_tab,
|
||||
height, width,
|
||||
scale_by,
|
||||
resize_mode,
|
||||
inpaint_full_res, inpaint_full_res_padding, inpainting_mask_invert,
|
||||
img2img_batch_files, img2img_batch_input_dir, img2img_batch_output_dir, img2img_batch_inpaint_mask_dir,
|
||||
override_settings,
|
||||
] + custom_inputs,
|
||||
inputs= img2img_args + custom_inputs,
|
||||
outputs=[
|
||||
img2img_gallery,
|
||||
generation_info,
|
||||
@@ -826,8 +831,8 @@ def create_ui(startup_timer = None):
|
||||
],
|
||||
show_progress=False,
|
||||
)
|
||||
img2img_prompt.submit(**img2img_args)
|
||||
submit.click(**img2img_args)
|
||||
img2img_prompt.submit(**img2img_dict)
|
||||
submit.click(**img2img_dict)
|
||||
|
||||
interrogate_args = dict(
|
||||
_js="get_img2img_tab_index",
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ pandas==1.5.3
|
||||
protobuf==3.20.3
|
||||
pytorch_lightning==1.9.4
|
||||
tokenizers==0.15.0
|
||||
transformers==4.35.2
|
||||
transformers==4.36.0
|
||||
tomesd==0.1.3
|
||||
urllib3==1.26.15
|
||||
Pillow==10.1.0
|
||||
|
||||
+4
-3
@@ -92,7 +92,7 @@ class Script(scripts.Script):
|
||||
if c != pipeline_base:
|
||||
shared.log.warning(f'{title}: pipeline={c} required={pipeline_base}')
|
||||
return None
|
||||
orig_pipepeline = shared.sd_model # backup current pipeline definition
|
||||
orig_pipeline = shared.sd_model # backup current pipeline definition
|
||||
shared.sd_model = pipeline_class( # create new pipeline using currently loaded model which is always in `shared.sd_model`
|
||||
# different pipelines may need different init params, so you may need to change this
|
||||
# to see init params, see pipeline_class.__init__ method
|
||||
@@ -107,9 +107,10 @@ class Script(scripts.Script):
|
||||
safety_checker=shared.sd_model.safety_checker,
|
||||
feature_extractor=shared.sd_model.feature_extractor,
|
||||
)
|
||||
sd_models.copy_diffuser_options(shared.sd_model, orig_pipeline) # copy options from original pipeline
|
||||
sd_models.set_diffuser_options(shared.sd_model) # set all model options such as fp16, offload, etc.
|
||||
if not ((shared.opts.diffusers_model_cpu_offload or shared.cmd_opts.medvram) or (shared.opts.diffusers_seq_cpu_offload or shared.cmd_opts.lowvram)):
|
||||
shared.sd_model.to(shared.device) # move pipeline if needed, but don't touch if its under automatic managment
|
||||
sd_models.set_diffuser_options(shared.sd_model) # set all model options such as fp16, offload, etc.
|
||||
|
||||
# if pipeline also needs a specific type, you can set it here, but not commonly needed
|
||||
# shared.sd_model = sd_models.set_diffuser_pipe(shared.sd_model, sd_models.DiffusersTaskType.IMAGE_2_IMAGE)
|
||||
@@ -136,5 +137,5 @@ class Script(scripts.Script):
|
||||
# you dont need to handle saving, metadata, etc - sdnext will do it for you
|
||||
|
||||
# restore original pipeline
|
||||
shared.sd_model = orig_pipepeline
|
||||
shared.sd_model = orig_pipeline
|
||||
return processed
|
||||
|
||||
Reference in New Issue
Block a user