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

Scrolling large Dataframe increases visible row size #9288

Closed
1 task done
bilzard opened this issue Sep 8, 2024 · 13 comments · Fixed by #9892
Closed
1 task done

Scrolling large Dataframe increases visible row size #9288

bilzard opened this issue Sep 8, 2024 · 13 comments · Fixed by #9892
Assignees
Labels
bug Something isn't working Priority High priority issues
Milestone

Comments

@bilzard
Copy link

bilzard commented Sep 8, 2024

Describe the bug

In my environment, scrolling long dataframe increasing visible row size.
I think it should be static size even scrolling.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
import pandas as pd
import numpy as np

with gr.Blocks() as demo:
    x = np.arange(1000)
    y = x**2

    metadata = pd.DataFrame(dict(x=x, y=y))
    df_display = gr.DataFrame(metadata, height=200, interactive=False)

demo.launch()

Screenshot

output.mp4

Logs

No js/python error printed (since its UI's malfunctioning)

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.43.0
gradio_client version: 1.3.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.4.0
fastapi: 0.112.4
ffmpy: 0.4.0
gradio-client==1.3.0 is not installed.
httpx: 0.27.2
huggingface-hub: 0.24.6
importlib-resources: 6.4.4
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.9.2
numpy: 2.1.1
orjson: 3.10.7
packaging: 24.1
pandas: 2.2.2
pillow: 10.4.0
pydantic: 2.9.0
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.2
ruff: 0.6.4
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.5
typing-extensions: 4.12.2
urllib3: 2.2.2
uvicorn: 0.30.6
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.9.0
httpx: 0.27.2
huggingface-hub: 0.24.6
packaging: 24.1
typing-extensions: 4.12.2
websockets: 12.0

Severity

I can work around it

@bilzard bilzard added the bug Something isn't working label Sep 8, 2024
@bilzard bilzard changed the title Scrolling Dataframe increases visible row size Scrolling large Dataframe increases visible row size Sep 8, 2024
@SwannLanthan
Copy link

I just had the same problem here!

@abidlabs
Copy link
Member

Which browser are y'all using?

@abidlabs abidlabs added the Priority High priority issues label Sep 10, 2024
@bilzard
Copy link
Author

bilzard commented Sep 10, 2024

@abidlabs I tested this issue reproduced in all of these thee environments. It seems not browser-specific issue.

  • Firefox: 129.0.2 (64-bit)
  • Chrome Version 128.0.6613.120 (Official Build) (arm64)
  • VSCode + Jupyter Extention

@abidlabs
Copy link
Member

You're right, I can reproduce this, thanks @bilzard, we'll take a look at this!

@abidlabs abidlabs added this to the Gradio 5️⃣ milestone Sep 10, 2024
@pngwn
Copy link
Member

pngwn commented Sep 12, 2024

This is definitely bad and wrong. Will fix when I tackle the data frame shortly.

@pngwn pngwn removed their assignment Sep 13, 2024
@cornzz
Copy link
Contributor

cornzz commented Sep 17, 2024

I'm also having this issue after upgrading from 4.40.0 to 4.44.0, see also this playground link.

It seems to be this line that was added in the SSR update which causes this behaviour, commenting it out fixes it.

A temporary fix is setting max-height and min-height in css for the dataframe:

qa_pairs = gr.Dataframe(data, elem_classes="qa-pairs")
.qa-pairs .table-wrap {
    min-height: 170px;
    max-height: 170px;
}

@abidlabs
Copy link
Member

abidlabs commented Sep 17, 2024

Thanks @cornzz for isolating the issue. We'll fix this as soon as we can (if you'd like, you can open a PR)

@Asianfleet
Copy link

the bug haven't been fixed yet.

@abidlabs
Copy link
Member

Another manifestation of this bug is happening on this Space: https://huggingface.co/spaces/lhoestq/Common-Crawl-Pipeline-Creator

@abidlabs abidlabs reopened this Oct 14, 2024
@abidlabs abidlabs assigned hannahblair and unassigned pngwn Oct 14, 2024
@lhoestq
Copy link

lhoestq commented Oct 14, 2024

^ for the common crawl space I used @cornzz workaround for now

@recursix
Copy link

For me, the workaround doesn't work. It fixes a viewport for the table, but the table grows inside the viewport and we cannot see the end of the table. (radio 5.3.0
)

@pambram
Copy link

pambram commented Oct 22, 2024

@abidlabs it seems to me another symptom of this bug (I happened to come across this as I'm working with Dataframe components today) is that the header row also changes size when scrolling, which doesn't seem to be something that should be intended.

I came across the bug on this issue, and by using the workaround described:

{
    min-height: 170px;
    max-height: 170px;
}

I was able to work fine. But the first row's height is also being increased and I'm not sure if this is FAD.

Repro code:

import gradio as gr

with gr.Blocks(
        css="#test_dataframe {min-height: 400px; max-height: 400px;}" # this is the workaround, working
) as demo:
    gr.Markdown("## Testing Dataframe ##")
    # Example dataset with 200 rows and 5 columns, each cell containing more than 200 characters
    example_data = [
        [
            "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " * 4,
            "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " * 4,
            "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris " * 4,
            "Nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in " * 4,
            "Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. " * 4
        ]
        for _ in range(200)
    ]
    documents_list = gr.DataFrame(
        value=example_data,
        headers=["Column 1", "Column 2", "Column 3", "Column 4", "Column 5"],
        elem_id="test_dataframe"
        #wrap=True,  # this just makes it 10x worse
    )
    gr.Button("Mock Button to a component after DataFrame")

demo.launch(debug=True)

this results in this test case:
Kapture 2024-10-22 at 22 15 17

In my real dataset it's much worse and more noticeable, because I also use wrap = True here:
Kapture 2024-10-22 at 22 16 49

@dtamien
Copy link

dtamien commented Nov 3, 2024

I've encountered a similar problem to what's described in #9288, but with an additional behavior: when the horizontal scrollbar is positioned at the far right and I scroll upward, the dataframe shrinks vertically, eventually flattening completely. This was observed while developing on Linux Mint 22.04 with the latest version of Chrome at this time, using both gradioand pythonCLI on my app.py with the gr.Dataframe component. It seems to further support the notion that this issue is not browser-specific, as it replicates across different environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority High priority issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.