Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images pass to the avatar won't appear on streamlit share #57

Open
le-baronysard opened this issue Jul 6, 2023 · 0 comments
Open

Images pass to the avatar won't appear on streamlit share #57

le-baronysard opened this issue Jul 6, 2023 · 0 comments

Comments

@le-baronysard
Copy link

le-baronysard commented Jul 6, 2023

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 :

Capture d’écran 2023-07-06 à 23 47 05

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant