AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
143.54k stars 27.02k forks source link

Extras tab not working #892

Closed EnzoAndree closed 2 years ago

EnzoAndree commented 2 years ago

Describe the bug the generate button does not work and the browser console displays an error message

To Reproduce Steps to reproduce the behavior:

  1. Send an image to Extras tab
  2. Click on generate
  3. See error

Expected behavior obtain a scaled image.

Desktop (please complete the following information):

Additional context Console log:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'querySelector')
    at get_tab_index ((index):782:38)
    at create_tab_index_args ((index):796:14)
    at get_extras_tab_index ((index):802:12)
    at eval (eval at <anonymous> (index.aa663a61.js:6368:21), <anonymous>:3:42)
    at index.aa663a61.js:7780:26
    at HTMLButtonElement.<anonymous> (index.aa663a61.js:6523:18)
    at index.aa663a61.js:527:44
    at Array.forEach (<anonymous>)
    at HTMLButtonElement.bubble (index.aa663a61.js:527:27)
    at HTMLButtonElement.click_handler (index.9b1b5b23.js:213:10)
get_tab_index @ (index):782
create_tab_index_args @ (index):796
get_extras_tab_index @ (index):802
eval @ VM797:3
(anonymous) @ index.aa663a61.js:7780
(anonymous) @ index.aa663a61.js:6523
(anonymous) @ index.aa663a61.js:527
bubble @ index.aa663a61.js:527
click_handler @ index.9b1b5b23.js:213
(anonymous) @ index.aa663a61.js:527
bubble @ index.aa663a61.js:527
click_handler @ index.9b1b5b23.js:93
Promise.then (async)
(anonymous) @ index.aa663a61.js:6538
(anonymous) @ index.aa663a61.js:527
bubble @ index.aa663a61.js:527
click_handler @ index.9b1b5b23.js:213
(anonymous) @ index.aa663a61.js:527
bubble @ index.aa663a61.js:527
click_handler @ index.9b1b5b23.js:93
dfaker commented 2 years ago

I can't reproduce get_extras_tab_index failing in that way unless you're no longer on the extras tab, and even then by calling from the script console.

This was using Send to extras from the txt2img tab, from there the small verion of the image appears correctly and you click generate without selecting any upscaler and nothing happens but in the console you get this error?

EyeDeck commented 2 years ago

Works for me. Maybe out of date browser cache? Shift or ctrl+F5 and try again.

dfaker commented 2 years ago

Works for me. Maybe out of date browser cache? Shift or ctrl+F5 and try again.

That'd certainly be consistent with the line numbers being all wrong in the log! But who knows what order the OS is giving them on glob.

Jonseed commented 2 years ago

Similar to #861 except I get no error.

EnzoAndree commented 2 years ago

@dfaker The same error appears in an incognito window, with any Upscaler model and any resize value. I reinstalled everything from scratch and the problem persists. Interestingly in the terminal, no errors are raised.

By the way, I'm running webui on a Linux machine and the browser on a Mac.

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'querySelector')
    at get_tab_index ((index):782:38)
    at create_tab_index_args ((index):796:14)
    at get_extras_tab_index ((index):802:12)
    at eval (eval at <anonymous> (index.aa663a61.js:6368:21), <anonymous>:3:42)
    at index.aa663a61.js:7780:26
    at HTMLButtonElement.<anonymous> (index.aa663a61.js:6523:18)
    at index.aa663a61.js:527:44
    at Array.forEach (<anonymous>)
    at HTMLButtonElement.bubble (index.aa663a61.js:527:27)
    at HTMLButtonElement.click_handler (index.9b1b5b23.js:213:10)
get_tab_index   @   (index):782
create_tab_index_args   @   (index):796
get_extras_tab_index    @   (index):802
eval    @   VM1041:3
(anonymous) @   index.aa663a61.js:7780
(anonymous) @   index.aa663a61.js:6523
(anonymous) @   index.aa663a61.js:527
bubble  @   index.aa663a61.js:527
click_handler   @   index.9b1b5b23.js:213
(anonymous) @   index.aa663a61.js:527
bubble  @   index.aa663a61.js:527
click_handler   @   index.9b1b5b23.js:93
Promise.then (async)        
(anonymous) @   index.aa663a61.js:6538
(anonymous) @   index.aa663a61.js:527
bubble  @   index.aa663a61.js:527
click_handler   @   index.9b1b5b23.js:213
(anonymous) @   index.aa663a61.js:527
bubble  @   index.aa663a61.js:527
click_handler   @   index.9b1b5b23.js:93
EnzoAndree commented 2 years ago

This PR does not seem to help

dfaker commented 2 years ago

And we are seeing these two tabs on the extras screen?:

image

I'm not sure how adventurous we're feeling, but if we right click and inspect one of those tabs, they are below an element with id="mode_extras"?:

image

EnzoAndree commented 2 years ago

I see those two tabs.

Although for me the ID is not mode_extras, it is component-277

image

If I change this Id to yours (id="mode_extras"), the Extras tab works without problems! What happened?

dfaker commented 2 years ago

Absolutely no idea! it's a terrifying prospect that we can't trust Gradio to set the tag ids correctly!

I'll offer a slightly more defensive version of that function in a PR, but that's a weird one.

EnzoAndree commented 2 years ago

Just to give you more information, when I switch tabs to txt2img for example, and back to Extras, the ID changes back to "component-277" again 😭

dfaker commented 2 years ago

Can you double check you're on the most recent commit and confirm the commit hash shown at startup if possible?

Ainaemaet commented 2 years ago

Having the same issue here, started happening after git pull an hour ago. Also fixed by changing component-277 to mode_extras, and unfixed by leaving that page.

AUTOMATIC1111 commented 2 years ago

if you check your config.json, does it look like the values in there are right?

EnzoAndree commented 2 years ago

The problem persists in the latest version 79e7c392989ad70a1c02cbfe6eb38ee5a78bdbce, the Id remains "component-277".

I don't know exactly what value to look for in config.json, but this is what it looks like

{
   "samples_save":true,
   "samples_format":"png",
   "samples_filename_pattern":"",
   "grid_save":true,
   "grid_format":"png",
   "grid_extended_filename":false,
   "grid_only_if_multiple":true,
   "n_rows":-1,
   "enable_pnginfo":true,
   "save_txt":false,
   "save_images_before_face_restoration":false,
   "jpeg_quality":80,
   "export_for_4chan":true,
   "use_original_name_batch":false,
   "outdir_samples":"",
   "outdir_txt2img_samples":"outputs/txt2img-images",
   "outdir_img2img_samples":"outputs/img2img-images",
   "outdir_extras_samples":"outputs/extras-images",
   "outdir_grids":"",
   "outdir_txt2img_grids":"outputs/txt2img-grids",
   "outdir_img2img_grids":"outputs/img2img-grids",
   "outdir_save":"log/images",
   "save_to_dirs":false,
   "grid_save_to_dirs":false,
   "directories_filename_pattern":"",
   "directories_max_prompt_words":8,
   "ESRGAN_tile":192,
   "ESRGAN_tile_overlap":8,
   "realesrgan_enabled_models":[
      "Real-ESRGAN 4x plus",
      "Real-ESRGAN 4x plus anime 6B"
   ],
   "SWIN_tile":192,
   "SWIN_tile_overlap":8,
   "ldsr_steps":100,
   "ldsr_pre_down":1,
   "ldsr_post_down":1,
   "upscaler_for_hires_fix":null,
   "face_restoration_model":null,
   "code_former_weight":0.5,
   "face_restoration_unload":false,
   "save_selected_only":false,
   "memmon_poll_rate":8,
   "samples_log_stdout":false,
   "multiple_tqdm":true,
   "sd_model_checkpoint":"model.ckpt [7460a6fa]",
   "img2img_color_correction":false,
   "img2img_fix_steps":false,
   "enable_quantization":false,
   "enable_emphasis":true,
   "enable_batch_seeds":true,
   "filter_nsfw":false,
   "random_artist_categories":[

   ],
   "interrogate_keep_models_in_memory":false,
   "interrogate_use_builtin_artists":true,
   "interrogate_clip_num_beams":1,
   "interrogate_clip_min_length":24,
   "interrogate_clip_max_length":48,
   "interrogate_clip_dict_limit":1500.0,
   "show_progressbar":true,
   "show_progress_every_n_steps":0,
   "return_grid":true,
   "add_model_hash_to_info":true,
   "font":"",
   "js_modal_lightbox":true,
   "js_modal_lightbox_initialy_zoomed":true
}
dfaker commented 2 years ago

Looks normal to me, one last thing, inside your local copy, could you check line 726 of stable-diffusion-webui/modules/ui.py to make sure it absolutely is being told to set the id of that tabs element?

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/79e7c392989ad70a1c02cbfe6eb38ee5a78bdbce/modules/ui.py#L726

And perhaps also check what version of gradio appears in the list returned by: venv\Scripts\python -m pip list

Jonseed commented 2 years ago

Now that I look in the console, I am getting the same error as #861. These are probably the same bug. Extras and img2img tab aren't working. I'm running gradio 3.2

EnzoAndree commented 2 years ago

@dfaker i confirm that the line is the same as in the repository.

gradio 3.3

    with gr.Blocks(analytics_enabled=False) as extras_interface:
        with gr.Row().style(equal_height=False):
            with gr.Column(variant='panel'):
                with gr.Tabs(elem_id="mode_extras"):
                    with gr.TabItem('Single Image'):
                        image = gr.Image(label="Source", source="upload", interactive=True, type="pil")

                    with gr.TabItem('Batch Process'):
                        image_batch = gr.File(label="Batch Process", file_count="multiple", interactive=True, type="file")

                upscaling_resize = gr.Slider(minimum=1.0, maximum=4.0, step=0.05, label="Resize", value=2)
dfaker commented 2 years ago

Can we see if that'll bump to 3.3.1 with:

venv\Scripts\python -m pip install gradio --upgrade

EnzoAndree commented 2 years ago

You are a genius! I upgraded to gradio v3.3.1 and it works!

I think we can close this issue.

Jonseed commented 2 years ago

I upgraded gradio to 3.3.1, shift-reloaded the webpage, and now the Extras and img2img tabs are working again!

dfaker commented 2 years ago

Wonderful news!

@AUTOMATIC1111 Older versions of gradio know nothing of the elem_id kwarg and will swallow the argument silently with **kwargs on the component class.