How to display image url

I just started using Streamlit (sorry if I’ve missed it in the docs!) but I still don’t know how to display an image with its image url instead of loading and opening an image locally using st.image

My current product is to get a user image and gives out a label after the classification model. Then based on the label, it matches with the loaded csv file that contains a list of labels and the associated product names, urls and image urls. I could display product names and urls as recommended products, but not the images. Any advice or help would be great!

Hi @savbanut, welcome to the Streamlit community!

This post shows how you can display a URL using st.markdown:

Thank you so much for replying! Sorry I have been trying it many times and I’m still having some trouble.
I tested it and the image doesn’t show up: Screen Shot 2020-06-19 at 7.29.38 PM

I think it’s the way I call these image links - it works if I directly put the link in as your example shows, but since the link is generated depending on my model, I wouldn’t be able to insert it directly since I don’t know what image would be shown.

currently, product1 would get the first link that is returned through my recommendation system, and I would like to display it

product_img = df['product_img'].tolist()
product1 = print(product_img[0])

but then st.markdown("![Product] product1)") would not work. Any ideas how to work around this?

1 Like