Update app.py
Browse files
app.py
CHANGED
|
@@ -49,6 +49,12 @@ def predict(message, system_prompt='', temperature=0.7, max_new_tokens=4096,Topp
|
|
| 49 |
st.title(TITLE)
|
| 50 |
st.write(DESCRIPTION)
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
if "messages" not in st.session_state:
|
| 54 |
st.session_state.messages = []
|
|
@@ -59,7 +65,7 @@ for message in st.session_state.messages:
|
|
| 59 |
st.markdown(message["content"])
|
| 60 |
|
| 61 |
# React to user input
|
| 62 |
-
if prompt :=
|
| 63 |
# Display user message in chat message container
|
| 64 |
st.chat_message("human",avatar = "π§βπ»").markdown(prompt)
|
| 65 |
# Add user message to chat history
|
|
@@ -72,12 +78,6 @@ if prompt := st.chat_input("Ask LLama-2-70b anything..."):
|
|
| 72 |
# Add assistant response to chat history
|
| 73 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
| 74 |
|
| 75 |
-
wav_audio_data = st_audiorec()
|
| 76 |
|
| 77 |
-
if wav_audio_data is not None:
|
| 78 |
-
# Save audio bytes
|
| 79 |
-
with open("audio.wav", "wb") as f:
|
| 80 |
-
f.write(audio_bytes)
|
| 81 |
-
|
| 82 |
|
| 83 |
|
|
|
|
| 49 |
st.title(TITLE)
|
| 50 |
st.write(DESCRIPTION)
|
| 51 |
|
| 52 |
+
textinput = st.chat_input("Ask LLama-2-70b anything...")
|
| 53 |
+
wav_audio_data = st_audiorec()
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
|
| 58 |
|
| 59 |
if "messages" not in st.session_state:
|
| 60 |
st.session_state.messages = []
|
|
|
|
| 65 |
st.markdown(message["content"])
|
| 66 |
|
| 67 |
# React to user input
|
| 68 |
+
if prompt := textinput:
|
| 69 |
# Display user message in chat message container
|
| 70 |
st.chat_message("human",avatar = "π§βπ»").markdown(prompt)
|
| 71 |
# Add user message to chat history
|
|
|
|
| 78 |
# Add assistant response to chat history
|
| 79 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
| 80 |
|
|
|
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
|