Unverified Commit e4145c84 authored by 48DESIGN's avatar 48DESIGN Committed by GitHub
Browse files

Merge branch 'master' into notification-sound

parents 2846ca57 c0b1177a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,3 +21,4 @@ __pycache__
/user.css
/.idea
notification.mp3
/SwinIR
+15 −9
Original line number Diff line number Diff line
@@ -68,13 +68,19 @@ window.addEventListener('paste', e => {
    if ( ! isValidImageList( files ) ) {
        return;
    }
    [...gradioApp().querySelectorAll('input[type=file][accept="image/x-png,image/gif,image/jpeg"]')]
        .filter(input => !input.matches('.\\!hidden input[type=file]'))
        .forEach(input => {
            input.files = files;
            input.dispatchEvent(new Event('change'))
        });
    [...gradioApp().querySelectorAll('[data-testid="image"]')]
        .filter(imgWrap => !imgWrap.closest('.\\!hidden'))
        .forEach(imgWrap => dropReplaceImage( imgWrap, files ));

    const visibleImageFields = [...gradioApp().querySelectorAll('[data-testid="image"]')]
        .filter(el => uiElementIsVisible(el));
    if ( ! visibleImageFields.length ) {
        return;
    }
    
    const firstFreeImageField = visibleImageFields
        .filter(el => el.querySelector('input[type=file]'))?.[0];

    dropReplaceImage(
        firstFreeImageField ?
        firstFreeImageField :
        visibleImageFields[visibleImageFields.length - 1]
    , files );
});
+2 −3
Original line number Diff line number Diff line
// various functions for interation with ui.py not large enough to warrant putting them in separate files

function selected_gallery_index(){
    var gr = gradioApp()
    var buttons = gradioApp().querySelectorAll(".gallery-item")
    var button = gr.querySelector(".gallery-item.\\!ring-2")
    var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem .gallery-item')
    var button = gradioApp().querySelector('[style="display: block;"].tabitem .gallery-item.\\!ring-2')

    var result = -1
    buttons.forEach(function(v, i){ if(v==button) { result = i } })
+1 −1
Original line number Diff line number Diff line
@@ -406,7 +406,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
                index_of_first_image = 1

            if opts.grid_save:
                images.save_image(grid, p.outpath_grids, "grid", all_seeds[0], all_prompts[0], opts.grid_format, info=infotext(), short_filename=not opts.grid_extended_filename, p=p)
                images.save_image(grid, p.outpath_grids, "grid", all_seeds[0], all_prompts[0], opts.grid_format, info=infotext(), short_filename=not opts.grid_extended_filename, p=p, grid=True)

    devices.torch_gc()
    return Processed(p, output_images, all_seeds[0], infotext(), subseed=all_subseeds[0], all_prompts=all_prompts, all_seeds=all_seeds, all_subseeds=all_subseeds, index_of_first_image=index_of_first_image)
+2 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ class State:
    job = ""
    job_no = 0
    job_count = 0
    job_timestamp = 0
    job_timestamp = '0'
    sampling_step = 0
    sampling_steps = 0
    current_latent = None
@@ -80,6 +80,7 @@ class State:
        self.job_no += 1
        self.sampling_step = 0
        self.current_image_sampling_step = 0
        
    def get_job_timestamp(self):
        return datetime.datetime.now().strftime("%Y%m%d%H%M%S")

Loading