Need help displaying Images

Hi, I am new to Streamlit and I have a question about how can I display images on my website

Hi @Ehiokn

You can use the st.image() method to display your image.

Here’s a code snippet:


import streamlit as st
from PIL import Image

image = Image.open('sunrise.jpg')

st.image(image, caption='Sunrise by the mountains')

Note: Your image file (e.g. sunrise.jpg) is located in the same folder as your app file. If the image is inside a subdirectory then you can specify the folder name as part of the path as in image = Image.open(β€˜path/to/sunrise.jpg’)

The above code snippet was taken from the Docs page for st.image.

Hope this helps!