Skip to content

Conversation

@Haoming02
Copy link
Contributor

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

@w-e-w
Copy link
Collaborator

w-e-w commented Nov 26, 2024

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
Copy link
Contributor Author

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
Copy link
Collaborator

w-e-w commented Nov 26, 2024

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

@Haoming02 Haoming02 closed this Nov 26, 2024
@w-e-w
Copy link
Collaborator

w-e-w commented Nov 26, 2024

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
Copy link
Contributor Author

True, forgot about that

@Haoming02 Haoming02 deleted the rnd-seed branch November 26, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants