gradio icon indicating copy to clipboard operation
gradio copied to clipboard

Don't serialize `gr.Gallery()` images to base64 format

Open abidlabs opened this issue 1 year ago • 2 comments

We currently serialize all gr.Gallery() images into base64 format (similar to gr.Image()). In the case of gr.Image() we may need to do this so that the image editor can edit the images. But we don't need this for gr.Gallery() and it can significantly slow down the loading time if there are a lot of images in the gallery. Let's remove this unnecessary serialization when an image file is provided.

As pointed out by @pngwn, we may not need to serialize images for gr.Image() either anymore, so we can remove the serialization logic from there as well.

h/t @apolinario

abidlabs avatar Sep 14 '22 14:09 abidlabs

Is the expected behavior to serve a file from the backend like we do for Video?

freddyaboulton avatar Sep 14 '22 14:09 freddyaboulton

Is the expected behavior to serve a file from the backend like we do for Video?

Yes exactly that would be the fix

abidlabs avatar Sep 14 '22 14:09 abidlabs