Spaces:
Build error
Build error
response was disapeering!
Browse files
app.py
CHANGED
|
@@ -109,5 +109,15 @@ if prompt := st.chat_input(f"Hi I'm {selected_model}, How can I help you today?"
|
|
| 109 |
stream=True
|
| 110 |
)
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
stream=True
|
| 110 |
)
|
| 111 |
|
| 112 |
+
# Create a placeholder for the streaming response
|
| 113 |
+
message_placeholder = st.empty()
|
| 114 |
+
full_response = ""
|
| 115 |
+
|
| 116 |
+
# Stream the response and accumulate it
|
| 117 |
+
for chunk in output:
|
| 118 |
+
full_response += chunk
|
| 119 |
+
message_placeholder.markdown(full_response + "▌")
|
| 120 |
+
|
| 121 |
+
# Display final response and store it
|
| 122 |
+
message_placeholder.markdown(full_response)
|
| 123 |
+
st.session_state.messages.append({"role": "assistant", "content": full_response})
|