gradio-app / gradio

Build and share delightful machine learning apps, all in Python. ๐ŸŒŸ Star to support our work!
http://www.gradio.app
Apache License 2.0
34.19k stars 2.6k forks source link

v5 Dataframe stuck in Loading if row_count = 0 #9793

Open pambram opened 1 month ago

pambram commented 1 month ago

Describe the bug

If row_count attribute of Dataframe component is initialized to 0, the startup queue hangs.

Have you searched existing issues? ๐Ÿ”Ž

Reproduction

import gradio as gr

with gr.Blocks() as demo:
    gr.Markdown("## Testing Dataframe ##")
    documents_list = gr.DataFrame(
        row_count=0, 
    )
    gr.Button("Mock Button to a component after DataFrame")

demo.launch(debug=True)

Screenshot

Snipaste_2024-10-22_16-28-25

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 5.3.0
gradio_client version: 1.4.2

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

aiofiles: 23.2.1
anyio: 4.4.0
fastapi: 0.115.3
ffmpy: 0.4.0
gradio-client==1.4.2 is not installed.
httpx: 0.27.2
huggingface-hub: 0.25.2
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 1.26.4
orjson: 3.10.7
packaging: 24.1
pandas: 2.2.2
pillow: 10.4.0
pydantic: 2.9.2
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.2
ruff: 0.6.4
semantic-version: 2.10.0
starlette: 0.41.0
tomlkit==0.12.0 is not installed.
typer: 0.12.5
typing-extensions: 4.12.2
urllib3: 2.2.2
uvicorn: 0.31.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2024.6.1
httpx: 0.27.2
huggingface-hub: 0.25.2
packaging: 24.1
typing-extensions: 4.12.2
websockets: 12.0

Severity

I can work around it

abidlabs commented 1 month ago

We can definitely make the error clearer, but what is the behavior you were expecting when row_count=0?

pambram commented 1 month ago

Hey @abidlabs, I was expecting an empty container which could then be updated with data based upon some selections from the user. If you don't explicitly set row_count and col_count on the init, the resulting component on screen has 3 columns and 2 rows, one of which is a header row with integers. I did not want that, so I stumbled into this bug.

I guess this is something that can be worked around by setting the visibilty to False for instance, but then again it also took me a good while to debug what was wrong because there was no logging nor did it throw any errors.

abidlabs commented 1 month ago

Makes sense to me, we'll fix this