yfszzx / stable-diffusion-webui-inspiration

114 stars 23 forks source link

ValueError: An event handler (select_click) didn't receive enough input values (needed: 2, got: 1) #37

Open jsmile opened 1 year ago

jsmile commented 1 year ago

I successfully installed inspiration extension and loaded artists images on inspiration tab in webui. But I clicked an image and then webui say red colored error. I use inspiration in vladmandic/automatic webui.

cmd console says :

File "F:\AI\Vlad1111\automatic\venv\lib\site-packages\gradio\routes.py", line 408, in run_predict output = await app.get_blocks().process_api( File "F:\AI\Vlad1111\automatic\venv\lib\site-packages\gradio\blocks.py", line 1313, in process_api inputs = self.preprocess_data(fn_index, inputs, state) File "F:\AI\Vlad1111\automatic\venv\lib\site-packages\gradio\blocks.py", line 1151, in preprocess_data self.validate_inputs(fn_index, inputs) File "F:\AI\Vlad1111\automatic\venv\lib\site-packages\gradio\blocks.py", line 1138, in validate_inputs raise ValueError( ValueError: An event handler (select_click) didn't receive enough input values (needed: 2, got: 1). Check if the event handler calls a Javascript function, and make sure its return value is correct. Wanted inputs: [textbox, state] Received inputs: ["NaN"]

Of cause, I saw No #34 issue.
I fix the code that [stable-diffusion-webui-inspiration]/javascript/inspiration.js like this From : var imgs = gallery.querySelectorAll("img.h-full")
To This : var imgs = gallery.querySelectorAll("img")

But the upper error massages occurs on cmd. What is my problem ? What should I do ?

( my runtime environment )
Python 3.10.10 on Windows Version: a2485cf7 Fri May 12 21:12:24 2023 -0400 Setting environment tuning nVidia CUDA toolkit detected Torch 2.0.0+cu118 Torch backend: nVidia CUDA 11.8 cuDNN 8700

image

vladmandic commented 1 year ago

in python, you can see that function has requires two parameters: name and name_list

select_button.click(select_click, _js="inspiration_selected", inputs=[name, name_list], outputs=[name, style_gallery, warning])

but javascript function is clearly returning just one value. this is a bug in extension:

function inspiration_selected(name, name_list){
    var btn = gradioApp().getElementById("inspiration_select_button")
    return [gradioApp().getElementById("inspiration_select_button").getAttribute("img-index")];
}  
amimi818 commented 1 year ago

I have the same problem as @jsmile . Is the author no longer maintaining this extension?

jsmile commented 1 year ago

I was suffering the same problem as above until yesterday, but it was not solved. Unfortunately, that's why I removed the inspection extension yesterday. I'm not an AI or Python developer, so I couldn't take any additional action.

vladmandic commented 1 year ago

this extension has not been updated in >6 months, i hope author comes back and fixed open issues.

jsmile commented 1 year ago

vladmandic, thanks you for your interest in this matter.

arpir commented 1 year ago

I have the same problem😂

vintol commented 1 year ago

Problem solved for now. Another Dirty Fix. This will create problems where multiple instances are running at the same time.

Make sure your inspiration.py is the same as mine. https://github.com/vintol/stable-diffusion-webui-inspiration/commit/6a5694be01fa52433d6ce01078e8c27166670fd4

schoenid commented 11 months ago

Lost hours by this bug!

Installed it from a new webui installation, by using it's Extensions tab, and removed it now, because of the incompatibility. Still not fixed, after more than a half year ...