Spaces:
Running
Running
Update pages.py
Browse files
pages.py
CHANGED
@@ -214,8 +214,19 @@ def audio_llm():
|
|
214 |
|
215 |
if "messages" not in st.session_state:
|
216 |
st.session_state.messages = []
|
217 |
-
|
218 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
with st.chat_message("user"):
|
220 |
st.write(prompt)
|
221 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
@@ -234,3 +245,6 @@ def audio_llm():
|
|
234 |
st.write(response)
|
235 |
raise(e)
|
236 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
|
|
|
|
|
214 |
|
215 |
if "messages" not in st.session_state:
|
216 |
st.session_state.messages = []
|
217 |
+
|
218 |
+
if 'disprompt' not in st.session_state:
|
219 |
+
st.session_state.disprompt = False
|
220 |
+
|
221 |
+
for message in st.session_state.messages[-2:]:
|
222 |
+
with st.chat_message(message["role"]):
|
223 |
+
st.write(message["content"])
|
224 |
+
|
225 |
+
if prompt := st.chat_input(
|
226 |
+
placeholder="Your Instruction",
|
227 |
+
disabled=st.session_state.disprompt,
|
228 |
+
on_submit=lambda: st.session_state.update(disprompt=True)
|
229 |
+
):
|
230 |
with st.chat_message("user"):
|
231 |
st.write(prompt)
|
232 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
|
|
245 |
st.write(response)
|
246 |
raise(e)
|
247 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
248 |
+
|
249 |
+
st.session_state.disprompt = False
|
250 |
+
st.rerun()
|