Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,8 @@ def query_model(api_url, payload):
|
|
17 |
return response.json()
|
18 |
|
19 |
def add_message_to_conversation(user_message, bot_message, model_name):
|
|
|
|
|
20 |
st.session_state.conversation.append((user_message, bot_message, model_name))
|
21 |
|
22 |
def initialize_memory():
|
@@ -83,8 +85,9 @@ st.markdown(
|
|
83 |
)
|
84 |
|
85 |
# Display the conversation
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
st.write('</div>', unsafe_allow_html=True)
|
|
|
|
17 |
return response.json()
|
18 |
|
19 |
def add_message_to_conversation(user_message, bot_message, model_name):
|
20 |
+
if "conversation" not in st.session_state:
|
21 |
+
st.session_state.conversation = []
|
22 |
st.session_state.conversation.append((user_message, bot_message, model_name))
|
23 |
|
24 |
def initialize_memory():
|
|
|
85 |
)
|
86 |
|
87 |
# Display the conversation
|
88 |
+
if "conversation" in st.session_state:
|
89 |
+
st.write('<div class="chat-container">', unsafe_allow_html=True)
|
90 |
+
for user_message, bot_message, model_name in st.session_state.conversation:
|
91 |
+
st.write(f'<div class="chat-bubble user">You: {user_message}</div>', unsafe_allow_html=True)
|
92 |
+
st.write(f'<div class="chat-bubble bot">{model_name}: {bot_message}</div>', unsafe_allow_html=True)
|
93 |
+
st.write('</div>', unsafe_allow_html=True)
|