New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image.change event is triggered twice since 3.31.0 #4589
Comments
I've come across this issue as well. in my branch of stable-diffusion-webui-wd14-tagger I circumvented every first callback using: def on_interrogate_image_change(*args):
# FIXME for some reason an image change is triggered twice.
# this is a dirty hack to prevent summation/flushing the output.
print("interrogator: "+args[1])
It.image_counter += 1
if It.image_counter & 1 == 0:
return It.results()
return on_interrogate_image(*args)
def on_interrogate_image(image: Image, interrogator: str, unload_after: bool):
if image is None:
return [None, None, None, 'No image']
if interrogator not in utils.interrogators:
return [None, None, None, f"'{interrogator}': invalid interrogator"]
interrogator: It = utils.interrogators[interrogator]
return interrogator.interrogate_image(image, unload_after) |
Was the issue resolved? I rewrote my code a bit and now no longer seem to have the issue. |
This issue is not resolved on import gradio as gr
def test(x):
print("change called")
return x
with gr.Blocks() as demo:
a = gr.Image()
b = gr.Image()
a.change(test, a, b)
demo.launch() I'm tackling the analogous issue for |
Feel free to take @abidlabs ! I have not started on this yet |
gradio-app/gradio#4589 It was recently fixed, but gradio 3.32, required by webui, does not have the change yet. For a while I didn't seem to have the effects, but it still occurs, and I it causes thresholds not to be adhered to, e.g. in ML interrogations
Describe the bug
Before 3.31.0, Image.change event is only triggered once by a function update, But since 3.31.0, the event is triggered twice.
Have you searched existing issues? 馃攷
Reproduction
After the service is started, you could click the second Image control to upload an image, and will see the following logs:
This issue only happens when gradio version >= 3.31.0, 3.30.0 and below are fine to me.
Screenshot
No response
Logs
No response
System Info
gradio>=3.31.0 MacOS 13.3.1 Chrome 113.0.5672.126
Severity
Blocking usage of gradio
The text was updated successfully, but these errors were encountered: