gradio icon indicating copy to clipboard operation
gradio copied to clipboard

The scrollbar cannot be displayed in gr.Gallery.

Open Kirsty-tong opened this issue 1 year ago • 3 comments

Describe the bug

The scrollbar cannot be displayed properly in gr.Gallery, and all images cannot be viewed by sliding up or down. I've tried gradio=5.6.0 and gradio=43.0.

Have you searched existing issues? 🔎

  • [X] I have searched and found no existing issues

Reproduction

import gradio as gr
gallery = gr.Gallery(
        label="Generated images", show_label=False, elem_id="gallery"
    , columns=[3], rows=[2], object_fit="contain", height=300)

Screenshot

image

Logs

No response

System Info

gradio=5.6.0 and gradio=43.0
gradio_client=1.4.3
Operating System: Linux

Severity

I can work around it

Kirsty-tong avatar Nov 25 '24 08:11 Kirsty-tong

I've encountered the same problem. Would you like to share how you work around it? Thanks.

askerlee avatar Jan 19 '25 16:01 askerlee

@askerlee @Kirsty-tong two other issues have also reported the bug: https://github.com/gradio-app/gradio/issues/10044 and https://github.com/gradio-app/gradio/issues/10115

but so far from what I've tried & looked around for, no progress have been made in solving the issue.

x-CK-x avatar Jan 21 '25 18:01 x-CK-x

@x-CK-x I see. I did find a workaround later (with the help of O1, of course):

css = '''
.custom-gallery { 
    height: 800px !important; 
    width: 100%; 
    margin: 10px auto; 
    padding: 0px; 
    overflow-y: auto !important; 
}
'''

out_gallery = gr.Gallery(label="Generated Images", interactive=False, columns=2, rows=4, height=800,
                         elem_classes="custom-gallery")

The "!important" did the trick.

askerlee avatar Jan 22 '25 06:01 askerlee