Read png from s3 using st.connection

Hi folks

I am facing a bug with my connection between Streamlit and aws s3
here I share my code snipped

conn = st.connection('s3', type=FilesConnection)
file_stream = conn.read(f"virgo-data/market_plots/{symbol_name}/{name}", input_format="png", ttl=30)
fig = Image.open(file_stream)
st.image(fig)

my goal is to read one png or jpeg file stored in S3 and display it in my app deployed in the community cloud.

I have been working with this type of connection for a while with other type of data formats such as json, csv and it is working fine

I will appreciate your help!
thanks!

  • What is the error message?
  • Could file_stream be read?

Hello Franky and thanks for contacting me

yes the error is

png is not a valid value for input_format=

Indeed, png is not valid:

However, neither image nor binary formats seems to be valid.
I would try it with input_format=None if the path argument has .png as suffix and see what happens…


Edit: After looking at the implementation i don’t think that any image or binary formats will work…