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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why can't my images be displayed in gr.Gallery() #8379

Closed
1 task done
IcyMing opened this issue May 25, 2024 · 1 comment
Closed
1 task done

Why can't my images be displayed in gr.Gallery() #8379

IcyMing opened this issue May 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@IcyMing
Copy link

IcyMing commented May 25, 2024

Describe the bug

I pre-set a set of images to display with gr.Gallery(), but it failed. And I can use gr.Image() to show my picture. Why锛烼hank you for everyone who reads this issue.

Have you searched existing issues? 馃攷

  • I have searched and found no existing issues

Reproduction

pattern_images = [
"http://localhost:8000/img1.png",
"http://localhost:8000/img2.png",
"http://localhost:8000/img3.png",
"http://localhost:8000/img4.png",
]

def generate_style_images(text, img_width, img_height, style, num_images):
selected_images = black_images[:num_images]
return selected_images

(.........)

                    with gr.Column():
                        output_style_img = gr.Gallery(label="images")
                    generate_style_button.click(fn=generate_style_images,
                                                inputs=[text_input,
                                                        style,
                                                        img_width,
                                                        img_height,
                                                        num_images,
                                                        ],
                                                outputs=output_style_img)

Screenshot

No response

Logs

No response

System Info

gradio-4.31.5

Severity

I can work around it

@IcyMing IcyMing added the bug Something isn't working label May 25, 2024
@abidlabs
Copy link
Member

Hi @IcyMing, you don't need to put localhost in the path to the images typically, e.g. you don't need to do: http://localhost:8000/img1.png. Instead, just put the path relative to the working directory where Gradio was launched from, e.g. ["img1.png", "img2.png", ...]

@abidlabs abidlabs closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants