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
Better handling of empty dataframe in gr.DataFrame
#5256
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/8bc5dded137d309c1cc3319456ebf1019d0a9236/gradio-3.40.1-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@8bc5dded137d309c1cc3319456ebf1019d0a9236#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.
|
This is interesting. So I'm not convinced this issue is actually a bug, it was by design. The reason some empty rows are rendered is so a user can click into the cells and start typing, tabbing, etc. With no rows present this isn't possible. |
We shouldn't be mutating the data to achieve this. As it stands, if you pass in a dataframe with 0 rows into a I don't think the UX issue is really there either, since we include a prominent "Add Row" button underneath the dataframe (as long as |
Yeah, that makes sense. |
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.
Looks good. Thanks for fixing this @abidlabs!
Thanks @pngwn! |
We were handling empty dataframes incorrectly in the
gr.Dataframe
--> we were turning them into single-row arrays with each cell being "".This fixes that -- would appreciate if folks could test this out to make sure I didn't miss anything as the dataframe frontend code is quite complex.
Fixes: #5162
Test code:
Also adds some stories for
gr.DataFrame
to prevent regressions like #5236 and some stories (unrelatedly) forgr.Dropdown()