-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Clean up gr.DataFrame.postprocess()
and fix issue with getting headers of empty dataframes
#10476
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/b17392159b0d8eace2a533e6333dce5e90ebaf27/gradio-5.14.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@b17392159b0d8eace2a533e6333dce5e90ebaf27#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/b17392159b0d8eace2a533e6333dce5e90ebaf27/gradio-client-1.10.0.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/b17392159b0d8eace2a533e6333dce5e90ebaf27/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.
|
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.
I confirmed that the issue is resolved and that my Spaces using gr.Dataframe
works as expected with the wheel in this PR as well. Thanks!
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.
Nice @abidlabs
if len(value) > 0 and isinstance(value[0], list): | ||
return len(value[0]) == 0 | ||
return len(value) == 0 | ||
elif isinstance(value, dict): |
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.
nit: I think the logic for dict is inconsistent. A df is empty if it has no values (even if his has headers). The dict is considered empty only if it doesn't have headers and values.
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.
Ah great catch thanks
Closes: #10474, refactored the
.postprocess()
method significantly to break it up into smaller methods & added tests for each method.