DenizD / Streamlit-Image-Carousel

Image Carousel Component for Streamlit
59 stars 10 forks source link

getting images from local files #1

Open lchunleo opened 3 years ago

lchunleo commented 3 years ago

Hi

Thanks for creating this awesome proj. i find it useful and would like to understand if it is possible to get local image files (instead from url). Thank you

DenizD commented 3 years ago

Hi,

Currently it only supports images from remote url

lchunleo commented 2 years ago

Hi,

Currently it only supports images from remote url

Thank you for your reply.

UrskaJ commented 2 years ago

how difficult would it be to support showing any images (not only from url)? specifically, i'd like show images that are created inside the code (let's say I have a bunch of images as the inference output and would want to show them with the slider)

DenizD commented 2 years ago

Unfortunately, it only supports images from remote url at this moment because I am showing the images in the Svelte side which cannot access to your local files.

This is not very practical at this moment but what you can do is to convert your local image files to remote urls (e.g. by sending images to some basic file server and retrieve the remote urls) and after you are done with showing the images, you can delete them from the remote file server

mdogan-ciitizen commented 2 years ago

@lchunleo , @UrskaJ a small old trick might help for showing local files. One can add a images directory inside public directory and add the path to the imageURLs in __init__.py as

imageUrls = [
    "images/image_1.jpg",
        "https://images.unsplash.com/photo-1522093007474-d86e9bf7ba6f?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=764&q=80",
...
]

svelte\streamlit\browsers are resolving that path. Thanks again for this great component @DenizDogan92

go-bears commented 2 years ago

thanks for the tip @mdogan-ciitizen , this worked for me!