Skip to content
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

Merged
merged 13 commits into from
Sep 24, 2024

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented Sep 21, 2024

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 documents gr.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

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Sep 21, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
🦄 Changes detecting...

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>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Sep 21, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

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

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs abidlabs changed the title Allow skipping an 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 Sep 21, 2024
@abidlabs abidlabs marked this pull request as ready for review September 21, 2024 07:42
@abidlabs
Copy link
Member Author

Fixed a few unrelated python typing issues on 5.0-dev

@abidlabs abidlabs marked this pull request as draft September 23, 2024 22:22
@abidlabs
Copy link
Member Author

The failing Python tests are also failing on 5.0-dev, as are the failing Lite tests. I'll take a look at the failing Python tests next, and @whitphx is looking into the Lite tests

@abidlabs abidlabs marked this pull request as ready for review September 23, 2024 23:00
Copy link
Collaborator

@freddyaboulton freddyaboulton left a 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?

@abidlabs
Copy link
Member Author

abidlabs commented Sep 23, 2024

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

@freddyaboulton
Copy link
Collaborator

Sounds good to me @abidlabs !

@abidlabs
Copy link
Member Author

Thanks for the review @freddyaboulton!

@abidlabs abidlabs merged commit 74f3b9d into 5.0-dev Sep 24, 2024
18 of 20 checks passed
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.

3 participants