Spaces:
Running
Running
Update pages.py
Browse files
pages.py
CHANGED
@@ -235,13 +235,18 @@ def audio_llm():
|
|
235 |
if "messages" not in st.session_state:
|
236 |
st.session_state.messages = []
|
237 |
|
238 |
-
if prompt := st.chat_input():
|
239 |
with st.chat_message("user"):
|
240 |
st.write(prompt)
|
241 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
242 |
|
243 |
with st.chat_message("assistant"):
|
244 |
with st.spinner("Thinking..."):
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
247 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
235 |
if "messages" not in st.session_state:
|
236 |
st.session_state.messages = []
|
237 |
|
238 |
+
if prompt := st.chat_input(placeholder="Your Instruction"):
|
239 |
with st.chat_message("user"):
|
240 |
st.write(prompt)
|
241 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
242 |
|
243 |
with st.chat_message("assistant"):
|
244 |
with st.spinner("Thinking..."):
|
245 |
+
try:
|
246 |
+
stream = generate_response(prompt, st.session_state.audio_base64)
|
247 |
+
response = st.write_stream(stream)
|
248 |
+
except Exception as e:
|
249 |
+
response = f"Caught Exception: {repr(e)}. Please contact the administrator to restart this space."
|
250 |
+
st.write(response)
|
251 |
+
raise(e)
|
252 |
st.session_state.messages.append({"role": "assistant", "content": response})
|