st-chat
st-chat copied to clipboard
Images pass to the avatar won't appear on streamlit share
The avatar argument in st.chat_message doesnt work with custom images. When putting the streamlit in streamlit share instead of the custom image this is what is shown :
I'm passing the custom image like that
avatar = Pil.Image.open("static/avatar.jpg")
with` st.chat_message("assistant",avatar=avatar):
with st.spinner("Thinking..."):
response = "Something the bot say"
st.write(response)
I have also tried to read the images differently :
avatar = open("static/avatar.jpg", "rb").read()
avatar = np.array(Image.open("data/avatar.jpg"))
All the methods works fine when running streamlit in local but fails in streamlit share
Edit :
I have noticed that the little image of my bot is served this way in htmle
<img src="/media/121f19f90f4c90cef78b3269ceb860024967c4a93b3e1ceee23993e3.jpg"
<-- my image was named avatar.jpg
If i remove the "/" in the beginning in the html code of the page it works
<img src="media/121f19f90f4c90cef78b3269ceb860024967c4a93b3e1ceee23993e3.jpg"
Maybe it could be a clue