-
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
Allow skipping an arbitrary number of output components, and also raise a warning if the number of output components does not match the number of values returned from a function #9406
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/c381f76e5105f1625f451459c6b4db1ae57537bb/gradio-4.44.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@c381f76e5105f1625f451459c6b4db1ae57537bb#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/c381f76e5105f1625f451459c6b4db1ae57537bb/gradio-client-1.6.0-beta.3.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/c381f76e5105f1625f451459c6b4db1ae57537bb/dist/lite.js""></script> |
🦄 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.
|
Fixed a few unrelated python typing issues on |
The failing Python tests are also failing on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks good but returning the single skip feels a bit magical to me. What's the use case?
When you have a very large number of output components, it’s inconvenient to create a list of skips if you just want to “abort early”. Stepped away for a little bit but it’s in issue linked from the linked issue above I believe |
Sounds good to me @abidlabs ! |
Thanks for the review @freddyaboulton! |
This PR does two things to improve the DX when working with many output components:
(1) It allows passing in a single
gr.skip()
to skip updating all of the components. It also documentsgr.skip()
, which had been completely undocumented. Closes: #9109(2) It raises a warning when the number of output components is smaller than the number of returned values from a function. Closes: #6883