Using `st.image` with URL(s)

Hello! I am new to streamlit. I have a list of image urls that I would like to display in my app (only one at a time) based on what a user inputs. However, when I pass one of the urls to st.image() , I get an error FileNotFoundError: [Errno 2] No such file or directory: 'Series([], )' . I checked the documentation and it reads as follows: image... OR a URL to fetch the image from... . This does mean I can use a url string and streamlit will, as the docs mention, fetch it for me? Or do I have to have the images locally downloaded? I have triple checked and am positive a valid url is getting passed to st.image() . Thanks in advance for this help, I really appreciate it and am really enjoying streamlit thus far.

For example, I am running the following code, which returns a url in string format:

image = df['teamPlayers.headshot_url'].to_string(index=False).lstrip()
st.image(image)

And it doesn’t work. But when I just hardcode the url, like so:

st.image('url.png')

It works… And I am not sure why this is happening.

Maybe your command is returning more than one string?
Have you tried to print it out? Also check if the type is string. Bc based on the error above it looks like you’re getting Series… instead of your url.

print(image)
print(type(image))