Commit 952ff32a authored by Bruno Seoane's avatar Bruno Seoane
Browse files
parents 21cbba34 35c45df2
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -29,4 +29,3 @@ notification.mp3
/textual_inversion
/textual_inversion
.vscode
.vscode
/extensions
/extensions
+1 −0
Original line number Original line Diff line number Diff line
@@ -75,6 +75,7 @@ titles = {
    "Create style": "Save current prompts as a style. If you add the token {prompt} to the text, the style use that as placeholder for your prompt when you use the style in the future.",
    "Create style": "Save current prompts as a style. If you add the token {prompt} to the text, the style use that as placeholder for your prompt when you use the style in the future.",


    "Checkpoint name": "Loads weights from checkpoint before making images. You can either use hash or a part of filename (as seen in settings) for checkpoint name. Recommended to use with Y axis for less switching.",
    "Checkpoint name": "Loads weights from checkpoint before making images. You can either use hash or a part of filename (as seen in settings) for checkpoint name. Recommended to use with Y axis for less switching.",
    "Inpainting conditioning mask strength": "Only applies to inpainting models. Determines how strongly to mask off the original image for inpainting and img2img. 1.0 means fully masked, which is the default behaviour. 0.0 means a fully unmasked conditioning. Lower values will help preserve the overall composition of the image, but will struggle with large changes.",


    "vram": "Torch active: Peak amount of VRAM used by Torch during generation, excluding cached data.\nTorch reserved: Peak amount of VRAM allocated by Torch, including all active and cached data.\nSys VRAM: Peak amount of VRAM allocation across all applications / total GPU VRAM (peak utilization%).",
    "vram": "Torch active: Peak amount of VRAM used by Torch during generation, excluding cached data.\nTorch reserved: Peak amount of VRAM allocated by Torch, including all active and cached data.\nSys VRAM: Peak amount of VRAM allocation across all applications / total GPU VRAM (peak utilization%).",


+39 −0
Original line number Original line Diff line number Diff line
@@ -13,6 +13,15 @@ function showModal(event) {
    }
    }
    lb.style.display = "block";
    lb.style.display = "block";
    lb.focus()
    lb.focus()

    const tabTxt2Img = gradioApp().getElementById("tab_txt2img")
    const tabImg2Img = gradioApp().getElementById("tab_img2img")
    // show the save button in modal only on txt2img or img2img tabs
    if (tabTxt2Img.style.display != "none" || tabImg2Img.style.display != "none") {
        gradioApp().getElementById("modal_save").style.display = "inline"
    } else {
        gradioApp().getElementById("modal_save").style.display = "none"
    }
    event.stopPropagation()
    event.stopPropagation()
}
}


@@ -81,6 +90,25 @@ function modalImageSwitch(offset) {
    }
    }
}
}


function saveImage(){
    const tabTxt2Img = gradioApp().getElementById("tab_txt2img")
    const tabImg2Img = gradioApp().getElementById("tab_img2img")
    const saveTxt2Img = "save_txt2img"
    const saveImg2Img = "save_img2img"
    if (tabTxt2Img.style.display != "none") {
        gradioApp().getElementById(saveTxt2Img).click()
    } else if (tabImg2Img.style.display != "none") {
        gradioApp().getElementById(saveImg2Img).click()
    } else {
        console.error("missing implementation for saving modal of this type")
    }
}

function modalSaveImage(event) {
    saveImage()
    event.stopPropagation()
}

function modalNextImage(event) {
function modalNextImage(event) {
    modalImageSwitch(1)
    modalImageSwitch(1)
    event.stopPropagation()
    event.stopPropagation()
@@ -93,6 +121,9 @@ function modalPrevImage(event) {


function modalKeyHandler(event) {
function modalKeyHandler(event) {
    switch (event.key) {
    switch (event.key) {
        case "s":
            saveImage()
            break;
        case "ArrowLeft":
        case "ArrowLeft":
            modalPrevImage(event)
            modalPrevImage(event)
            break;
            break;
@@ -198,6 +229,14 @@ document.addEventListener("DOMContentLoaded", function() {
    modalTileImage.title = "Preview tiling";
    modalTileImage.title = "Preview tiling";
    modalControls.appendChild(modalTileImage)
    modalControls.appendChild(modalTileImage)


    const modalSave = document.createElement("span")
    modalSave.className = "modalSave cursor"
    modalSave.id = "modal_save"
    modalSave.innerHTML = "🖫"
    modalSave.addEventListener("click", modalSaveImage, true)
    modalSave.title = "Save Image(s)"
    modalControls.appendChild(modalSave)

    const modalClose = document.createElement('span')
    const modalClose = document.createElement('span')
    modalClose.className = 'modalClose cursor';
    modalClose.className = 'modalClose cursor';
    modalClose.innerHTML = '×'
    modalClose.innerHTML = '×'
+2 −22
Original line number Original line Diff line number Diff line
@@ -45,14 +45,14 @@ function switch_to_txt2img(){
    return args_to_array(arguments);
    return args_to_array(arguments);
}
}


function switch_to_img2img_img2img(){
function switch_to_img2img(){
    gradioApp().querySelector('#tabs').querySelectorAll('button')[1].click();
    gradioApp().querySelector('#tabs').querySelectorAll('button')[1].click();
    gradioApp().getElementById('mode_img2img').querySelectorAll('button')[0].click();
    gradioApp().getElementById('mode_img2img').querySelectorAll('button')[0].click();


    return args_to_array(arguments);
    return args_to_array(arguments);
}
}


function switch_to_img2img_inpaint(){
function switch_to_inpaint(){
    gradioApp().querySelector('#tabs').querySelectorAll('button')[1].click();
    gradioApp().querySelector('#tabs').querySelectorAll('button')[1].click();
    gradioApp().getElementById('mode_img2img').querySelectorAll('button')[1].click();
    gradioApp().getElementById('mode_img2img').querySelectorAll('button')[1].click();


@@ -65,26 +65,6 @@ function switch_to_extras(){
    return args_to_array(arguments);
    return args_to_array(arguments);
}
}


function extract_image_from_gallery_txt2img(gallery){
    switch_to_txt2img()
    return extract_image_from_gallery(gallery);
}

function extract_image_from_gallery_img2img(gallery){
    switch_to_img2img_img2img()
    return extract_image_from_gallery(gallery);
}

function extract_image_from_gallery_inpaint(gallery){
    switch_to_img2img_inpaint()
    return extract_image_from_gallery(gallery);
}

function extract_image_from_gallery_extras(gallery){
    switch_to_extras()
    return extract_image_from_gallery(gallery);
}

function get_tab_index(tabId){
function get_tab_index(tabId){
    var res = 0
    var res = 0


+389 −421

File changed.

Preview size limit exceeded, changes collapsed.

Loading