gradio
gradio copied to clipboard
The scrollbar cannot be displayed in gr.Gallery.
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
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
I've encountered the same problem. Would you like to share how you work around it? Thanks.
@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 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.