Spaces:
Sleeping
Sleeping
Pratik Dwivedi
commited on
Commit
·
4e20e20
1
Parent(s):
1540802
apps
Browse files
app.py
CHANGED
@@ -7,16 +7,16 @@ def main():
|
|
7 |
if 'messages' not in st.session_state:
|
8 |
st.session_state.messages = []
|
9 |
|
10 |
-
|
11 |
-
for message in st.session_state.messages:
|
12 |
-
if message["sender"] == "user":
|
13 |
-
st.write("You: ", message["message"])
|
14 |
-
else:
|
15 |
-
st.write("Bot: ", message["message"])
|
16 |
-
|
17 |
user_input = st.chat_input("You", key="user_input")
|
18 |
if user_input:
|
19 |
st.session_state.messages.append({"sender": "user", "message": user_input})
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
if __name__ == "__main__":
|
22 |
main()
|
|
|
7 |
if 'messages' not in st.session_state:
|
8 |
st.session_state.messages = []
|
9 |
|
10 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
user_input = st.chat_input("You", key="user_input")
|
12 |
if user_input:
|
13 |
st.session_state.messages.append({"sender": "user", "message": user_input})
|
14 |
+
# display all the messages already in the session state
|
15 |
+
for message in st.session_state.messages:
|
16 |
+
if message["sender"] == "user":
|
17 |
+
st.write("You: ", message["message"])
|
18 |
+
else:
|
19 |
+
st.write("Bot: ", message["message"])
|
20 |
|
21 |
if __name__ == "__main__":
|
22 |
main()
|