AUTOMATIC1111 / stable-diffusion-webui

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

Randomize Seed using Gradio Event #16684

Closed Haoming02 closed 5 days ago

Haoming02 commented 5 days ago

Was there any reason to do this via JavaScript instead of Gradio's native Events?

w-e-w commented 5 days ago

I don't know the original reasoning but I will say that JavaScript fully client side so faster I see no reason to involve the server in this action

Haoming02 commented 5 days ago

Wait, JS is actually faster in this case? I thought the native method would be faster

Guess I'll close this then

w-e-w commented 5 days ago

yeah that JavaScript is fully client side so it's basically instantaneous (and would even work when the server is not running)

where as if you use native gradio event then it will have to ask the server what to do if the server is on the same computer then it's basically instantaneous but if you're on different device you might see a slight delay

you could simulate a bad network if you want using dev tooles image

w-e-w commented 5 days ago

by the way in the future if you wish to make changes like this then it's best not to remove the old function even though it's no longer used by web UI itself as extensions may use it

from a quick search I found two extensions that uses setRandomSeed (one ext by me)

Haoming02 commented 5 days ago

True, forgot about that