diff --git a/.pylintrc b/.pylintrc index 68a2f4093..b57f41c89 100644 --- a/.pylintrc +++ b/.pylintrc @@ -85,7 +85,7 @@ max-locals=99 max-parents=99 max-public-methods=99 max-returns=99 -max-statements=99 +max-statements=199 min-public-methods=1 [EXCEPTIONS] diff --git a/TODO.md b/TODO.md index f48a0be98..8f83079bb 100644 --- a/TODO.md +++ b/TODO.md @@ -24,6 +24,7 @@ Stuff to be added, in no particular order... - Backends: - PyTorch / XLA - Diffusers / ONNX + - ScaleCrafter - New Minor - Prompt padding for positive/negative - New Major diff --git a/javascript/extraNetworks.js b/javascript/extraNetworks.js index 5708ca254..45a3bc64e 100644 --- a/javascript/extraNetworks.js +++ b/javascript/extraNetworks.js @@ -20,7 +20,10 @@ const getENActiveTab = () => gradioApp().getElementById('tab_txt2img').style.dis const getENActivePage = () => { const tabname = getENActiveTab(); const page = gradioApp().querySelector(`#${tabname}_extra_networks > .tabs > .tab-nav > .selected`); - return page ? page.innerText : ''; + const pageName = page ? page.innerText : ''; + const btnApply = gradioApp().getElementById(`${tabname}_extra_apply`); + if (btnApply) btnApply.style.display = pageName === 'Style' ? 'inline-flex' : 'none'; + return pageName; }; const setENState = (state) => { @@ -193,10 +196,12 @@ function setupExtraNetworksForTab(tabname) { const btnSave = gradioApp().getElementById(`${tabname}_extra_save`); const btnClose = gradioApp().getElementById(`${tabname}_extra_close`); const btnModel = gradioApp().getElementById(`${tabname}_extra_model`); + const btnApply = gradioApp().getElementById(`${tabname}_extra_apply`); const buttons = document.createElement('span'); buttons.classList.add('buttons'); if (btnRefresh) buttons.appendChild(btnRefresh); if (btnModel) buttons.appendChild(btnModel); + if (btnApply) buttons.appendChild(btnApply); if (btnScan) buttons.appendChild(btnScan); if (btnSave) buttons.appendChild(btnSave); if (btnClose) buttons.appendChild(btnClose); diff --git a/javascript/nvml.js b/javascript/nvml.js index 63a5b5371..a557c43d5 100644 --- a/javascript/nvml.js +++ b/javascript/nvml.js @@ -5,14 +5,12 @@ let nvmlTable = null; async function updateNVML() { try { const res = await fetch('/sdapi/v1/nvml'); - console.log('HERE1', res); if (!res.ok) { clearInterval(nvmlInterval); nvmlEl.style.display = 'none'; return; } const data = await res.json(); - console.log('HERE2', data); if (!data) { clearInterval(nvmlInterval); nvmlEl.style.display = 'none'; diff --git a/javascript/style.css b/javascript/style.css index 80c2e5471..5a29a923a 100644 --- a/javascript/style.css +++ b/javascript/style.css @@ -181,6 +181,7 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt .extra-networks .description { flex: 3; } .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 { height: 1.2em; margin-top: var(--spacing-md); } .extra-networks .custom-button { width: 120px; width: 100%; background: none; justify-content: left; text-align: left; padding: 2px 8px 2px 16px; text-indent: -8px; box-shadow: none; line-break: auto; } .extra-networks .custom-button:hover { background: var(--button-primary-background-fill) } .extra-networks-tab { padding: 0 !important; } diff --git a/modules/sd_samplers_cfg_denoiser.py b/modules/sd_samplers_cfg_denoiser.py index 739b2fe58..56c16aafe 100644 --- a/modules/sd_samplers_cfg_denoiser.py +++ b/modules/sd_samplers_cfg_denoiser.py @@ -62,7 +62,7 @@ class CFGDenoiser(torch.nn.Module): @property def inner_model(self): - raise NotImplementedError() + raise NotImplementedError def combine_denoised(self, x_out, conds_list, uncond, cond_scale): denoised_uncond = x_out[-uncond.shape[0]:] diff --git a/modules/ui.py b/modules/ui.py index d1ca402e5..112a42c82 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -261,8 +261,10 @@ def create_toprow(is_img2img): negative_token_button = gr.Button(visible=False, elem_id=f"{id_part}_negative_token_button") with gr.Row(elem_id=f"{id_part}_styles_row"): prompt_styles = gr.Dropdown(label="Styles", elem_id=f"{id_part}_styles", choices=[style.name for style in modules.shared.prompt_styles.styles.values()], value=[], multiselect=True) - prompt_styles_btn = gr.Button('Apply', elem_id=f"{id_part}_styles_select", visible=False) - prompt_styles_btn.click(_js="applyStyles", fn=parse_style, inputs=[prompt_styles], outputs=[prompt_styles]) + prompt_styles_btn_select = gr.Button('Select', elem_id=f"{id_part}_styles_select", visible=False) + prompt_styles_btn_select.click(_js="applyStyles", fn=parse_style, inputs=[prompt_styles], outputs=[prompt_styles]) + prompt_styles_btn_apply = ToolButton(symbols.apply, elem_id=f"{id_part}_extra_apply", visible=False) + prompt_styles_btn_apply.click(fn=apply_styles, inputs=[prompt, negative_prompt, prompt_styles], outputs=[prompt, negative_prompt, prompt_styles]) return prompt, prompt_styles, negative_prompt, submit, button_interrogate, button_deepbooru, button_paste, button_extra, token_counter, token_button, negative_token_counter, negative_token_button