Hello, I am having a problem with using HTML in displaying an image that is saved in my GitHub repository g1_mdrrmo_wxdashboard. My Streamlit app is a multipage app, which I have already deployed on Community Cloud (link: https://g1-mdrrmo-wxdashboard.streamlit.app/). The requirements file is here: requirements.txt. The app’s homepage is “ Home.py” and the other pages located inside the “g1_mdrrmo_wxdashboard/pages” directory. I also have a “g1_mdrrmo_wxdashboard/.streamlit” folder, which contains “config.toml” which in turn contains:
[server]
enableStaticServing = true
I am using Streamlit version 1.49.1 and Python 3.11.5 for this project, especially when I was still developing this app on my computer.
I intended to add images files of warning icons in the “1_⚠️ Advisories & Warnings.py” page using HTML. And I need the warning icon to be centered inside its corresponding container, with a label below indicating the date and time of warning issuance. But since Streamlit apparently cannot directly set the horizontal alignment of text and images.
At first, I resorted to using HTML, which was easy when the files were inside my computer (I’ll just insert the absolute path). But knowing that I need to deploy this so that my colleagues can use the app, I need a way to cut the app’s dependency on files stored in my computer’s local storage. I first tried to upload the icons to Wikimedia Commons, but even though it worked okay (but putting the direct URL to the file), it puts a risk that some, if not all, of the files will be deleted, and not all files can be uploaded there.
Since Google Drive won’t work and I don’t have funds to use Amazon or Google Cloud Storage, I decided to store them to the “g1_mdrrmo_wxdashboard/static/” folder in my directory.
I tried revising the visuals for one of the image files to see if the suggested workarounds would work. I did this for the file “rain warning - 00 (tstm adv).png” (icon for Thunderstorm Advisory):
# Setting row 1
wxrow1 = st.container(horizontal=True, horizontal_alignment='center')
# Thunderstorm
tstm = wxrow1.container(width=300)
tstm.write('##### Thunderstorm')
tstm_content = tstm.container(height=200, border=True)
tstm_content.markdown(
"""
<div style="display: flex; justify-content: center; align-items: center; height: 100%;">
<img src="app/static/rain warning - 00 (tstm adv).png" width="145">
</div>
<div style="text-align: center; font-size: small;">
as of 10:00 AM 31 August 2025
</div>
""",
unsafe_allow_html=True
)
with tstm.expander('Details'):
st.write(
'''
Moderate to heavy rainshowers with possible isolated intense downpours, accompanied with lightning and strong winds, are ongoing or likely to occur within 1-2 hours.
'''
)
But even though I already applied the format “”, and even though the file is present in the static folder, the file name and extension are correct, the file is not corrupted, and static file serving is enabled in .streamlit/config.toml, the image still does not appear, as shown in the following screenshot:
As shown in the screenshot, the Thunderstorm Advisory icon (“rain warning - 00 (tstm adv).png”) is not visible, but the other icons (which are dependent on the files I previously uploaded in Wikimedia Commons) are still visible.
I tried using the Streamlit docs assistant AI, but it explained that “the knowledge sources do not provide further troubleshooting steps for this specific scenario”.
I would greatly appreciate your help in this matter. Thank you very much in advance.