-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decrease latency: do not run pre and postprocess in threadpool #7796
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/df11e7333b404489399cfc36a0a3903b3163df2b/gradio-4.22.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@df11e7333b404489399cfc36a0a3903b3163df2b#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
So just to understand, we still postprocess gallery images in separate parallel threads due to this change in #7327 : However, the general case, we do not run I tested this out with images of different sizes and didn't notice a significant difference compared to |
Yes! |
Thanks for the review @abidlabs ! |
Description
In #7327, we run pre-post process in a separate threadpool to not block the event loop in the event a component has an expensive processing function. This introduces some latency for most demos so it's not worth it. We still process the gallery images in parallel so will prevent prevent the issue with galleries from #7327 from coming up again. In the attached gif, we process 30 images of 1.6 mb (left panel) and 1 mb (right panel) and the latency is minimal and the event loop is not blocked.
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh