Change default avatars in st chat

Hi.

Is there an option to use a different emoji for default st chat emojis?
(the ones on the left of the UI, not the avatars you can concatenate to a message)

You can pass an avatar argument

import streamlit as st

st.chat_message("user", avatar="πŸ˜‚").write("Hello")
st.chat_message("user", avatar="πŸ‘©β€πŸŽ€").write("Hi!")
st.chat_message("user", avatar="πŸ‘©β€πŸŽ¨").write("Hey!")

Hello!,
You can use the avatar parameter in st.chat_message to change the avatar of the chat

import streamlit as st

with st.chat_message('Momos', avatar="πŸ€–"):
    st.write('Hello there!')
with st.chat_message('Me', avatar="πŸ¦–"):
    st.write("Hi!")

image

You can also add your own image by using st.image:

with st.chat_message('Momos', avatar=st.image('path_to_image'):
    st.write('Hello there!')

For changing avatars in chat input, simply use chat_message instead of st.write

prompt = st.chat_input('Enter your prompt!')
if prompt:
   with st.chat_message('Momos', avatar="πŸ€–"):
    st.write('Hello again... again!') 

Cheers,
Moiz

4 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.