Render PDFs in a Streamlit App on Snowflake

Hi,

I am attempting to render PDFs stored in a Snowflake stage within a Streamlit application in snowflake. However, when I try to read these files using the SnowflakeFile module, I encounter a “Not Implemented” exception.

If there is an alternative method to achieve this, I would appreciate any guidance or suggestions.

Code snippet:

pdf_url = 'internal_stage/files/raw/some.pdf'

 with SnowflakeFile.open(pdf_url,"rb") as file:
 base64_pdf = base64.b64decode(file.read()).decode("utf-8")

 pdf_display=f''
 st.markdown(pdf_display,unsafe_allow_html=True)

“NotImplementedError: SnowflakeFile currently only works in UDF and Stored Procedures. It doesn’t work locally yet.”

Thanks,
maverick.