gr.Dataframe(): changes to height, scrolling initialization
It appears there were recent changes made to the gr.Dataframe() component in Gradio ([Add height parameter and scrolling togr.Dataframeby abidlabs · Pull Request #5283 · gradio-app/gradio · GitHub]). This has affected a working UI of mine which, before this update, had a Dataframe whose height automatically fit the number of rows by default. After this change, the datframe now defaults to only ~12 rows and a scrollbar appears (here’s how I initialize the df):plotting_df=gr.Dataframe(value=df, headers=["class","type","group","ε54Cr","ε50Ti","ε94Mo"], 
 type="pandas", visible=True, interactive=False)Despite reading the new documentation, I am struggling to revert the dataframe back to it’s original behavior. I have tried setting the new height parameter (in pixels) to very large values, but this does not result in the desired appearance. To be clear, I’d like the dataframeheightto automatically fit the length, determined by the number of rows (which can change as a result of user inputs to other parts of the UI, although plotting_df itself is not interactive). Thewidthis not a concern, as the current default behavior for overflow (scrollbar) is ok.I’d appreciate if others would recommend how I should initialize this df to achieve the original functionality.Thank you in advance.
2023-09-18T07:54:01Z
Hi@dpraz, can you us to the Gradio app (if it’s open source or hosted on Spaces for instance) – or a minimal reproducer?cc@pngwn
2023-09-18T13:51:09Z
Hi@julien-c,@pngwnThanks for your interest.Here is a minimal reproducer of the issue, as an hf.space on my page.As you can see, the dataframe defaults to 12 rows long, while the actual height should be 29 rows. This results in an odd appearance. Note that I don’t want to simply set number of rows to 29, for example, because in my actual code the number of rows is subject to change. In every case, I’d like the height of the dataframe to be equal to the total number of rows.Thanks!
2023-09-18T15:35:57Z
Hi@dpraz!In gradio version 3.43 we changed the dataframe to load a fixed number of pixels and lazily load the other rows. This was done for performance as automatically loading even small (~100 rows) dataframes was introducing a lot of lag.Right now there isn’t a way to disable this behavior but we’re also looking into improving the sorting and filtering capabilities of the dataframe to make is easier for users to find data outside the first rendered rows.
2023-09-18T16:26:33Z
Hi@freddyaboulton- thanks for the reply. Instead of disabling this behavior, what is the easiest way to achieve to the default gr.Dataframe() behavior of the previous gradio version. Is there a way to specifically import and run an old gradio version? This could work temporarily while you all work on finalizing the dataframe behavior. Ideally, in a future version, you could make this an option for the height (or another) parameter.Secondly, is there a maximum to the height (in pixels) in the current version of gradio, 3.43? I am not noticing a difference between setting height=100,000 and height=1,000,000. If not possible to restore the old functionality where the height fits the number of rows, I guess the best ‘solution’ for me would be to max out the height setting.Thanks!
2023-09-18T17:23:16Z
I achieved success by installing gradio==3.42.0, in case that is helpful for others experiencing a similar issue. Still not sure how best to work with gr.Dataframe(), specifically the height/scroll functionality, in light of the updates in 3.43.0. Other’s can see myminimal reproducing issue here, and the issues that arise with scrolling and height. Hint: try scrolling on the dataframe.Thanks all for the interest and help.