Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,25 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import streamlit.components.v1 as components
|
| 3 |
|
| 4 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
default_chat_input_value = "Default Value"
|
| 6 |
js = f"""
|
| 7 |
<script>
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import streamlit.components.v1 as components
|
| 3 |
|
| 4 |
+
st.title("Echo Bot")
|
| 5 |
+
|
| 6 |
+
# Initialize chat history
|
| 7 |
+
if "messages" not in st.session_state:
|
| 8 |
+
st.session_state.messages = []
|
| 9 |
+
|
| 10 |
+
# Display chat messages from history on app rerun
|
| 11 |
+
for message in st.session_state.messages:
|
| 12 |
+
with st.chat_message(message["role"]):
|
| 13 |
+
st.markdown(message["content"])
|
| 14 |
+
|
| 15 |
+
# React to user input
|
| 16 |
+
if prompt := st.chat_input("What is up?"):
|
| 17 |
+
# Display user message in chat message container
|
| 18 |
+
with st.chat_message("user"):
|
| 19 |
+
st.markdown(prompt)
|
| 20 |
+
|
| 21 |
+
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 22 |
+
|
| 23 |
default_chat_input_value = "Default Value"
|
| 24 |
js = f"""
|
| 25 |
<script>
|