Ashhar commited on
Commit
0bc0145
·
1 Parent(s): 10cde02

changed avatars

Browse files
Files changed (3) hide show
  1. app.py +6 -4
  2. baby.png +0 -0
  3. man.png +0 -0
app.py CHANGED
@@ -53,9 +53,9 @@ Some of your dialogues in the past:
53
  - Blue car, kahaan hai
54
  - Dekho, white car :) (looking at a random white car on road)
55
  - Duddoo (milk) peena hai
56
-
57
  """
58
 
 
59
  ipAddress = st.context.headers.get("x-forwarded-for")
60
 
61
 
@@ -93,6 +93,7 @@ def predict(prompt):
93
 
94
 
95
  st.title("Chat with Aariz Bhayya 👶🏻")
 
96
 
97
  if "messages" not in st.session_state:
98
  st.session_state.messages = []
@@ -101,16 +102,17 @@ if "messages" not in st.session_state:
101
  for message in st.session_state.messages:
102
  role = message["role"]
103
  content = message["content"]
104
- with st.chat_message(role):
 
105
  st.markdown(content)
106
 
107
  if prompt := st.chat_input("Mummaaaaa..."):
108
- with st.chat_message("user"):
109
  st.markdown(prompt)
110
  pprint(f"{prompt=}")
111
  st.session_state.messages.append({"role": "user", "content": prompt })
112
 
113
- with st.chat_message("assistant"):
114
  responseGenerator = predict(prompt)
115
  response = st.write_stream(responseGenerator)
116
  pprint(f"{response=}")
 
53
  - Blue car, kahaan hai
54
  - Dekho, white car :) (looking at a random white car on road)
55
  - Duddoo (milk) peena hai
 
56
  """
57
 
58
+ # st.set_page_config(menu_items={"About": None})
59
  ipAddress = st.context.headers.get("x-forwarded-for")
60
 
61
 
 
93
 
94
 
95
  st.title("Chat with Aariz Bhayya 👶🏻")
96
+ # st.image("baby.png")
97
 
98
  if "messages" not in st.session_state:
99
  st.session_state.messages = []
 
102
  for message in st.session_state.messages:
103
  role = message["role"]
104
  content = message["content"]
105
+ avatar = "baby.png" if role == "user" else "man.png"
106
+ with st.chat_message(role, avatar=avatar):
107
  st.markdown(content)
108
 
109
  if prompt := st.chat_input("Mummaaaaa..."):
110
+ with st.chat_message("user", avatar="man.png"):
111
  st.markdown(prompt)
112
  pprint(f"{prompt=}")
113
  st.session_state.messages.append({"role": "user", "content": prompt })
114
 
115
+ with st.chat_message("assistant", avatar="baby.png"):
116
  responseGenerator = predict(prompt)
117
  response = st.write_stream(responseGenerator)
118
  pprint(f"{response=}")
baby.png ADDED
man.png ADDED