Commit
·
8049022
1
Parent(s):
5f0fadf
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,6 +108,18 @@ if st.session_state.messages[-1]["role"] == "user" and "image" in st.session_sta
|
|
| 108 |
"content": f"System: you received an image and a question: the question is: " + st.session_state.messages[-1]["content"].lower() + f"and that is the {Imagecaptioned} write an better answer",
|
| 109 |
}
|
| 110 |
st.session_state.messages.append(message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
# Generate a new response if the last message is not from the assistant
|
| 113 |
if st.session_state.messages[-1]["role"] != "assistant" and not "image" in st.session_state.messages[-1]["content"].lower():
|
|
|
|
| 108 |
"content": f"System: you received an image and a question: the question is: " + st.session_state.messages[-1]["content"].lower() + f"and that is the {Imagecaptioned} write an better answer",
|
| 109 |
}
|
| 110 |
st.session_state.messages.append(message)
|
| 111 |
+
with st.chat_message("assistant"):
|
| 112 |
+
with st.spinner("Thinking..."):
|
| 113 |
+
response = generate_llama2_response(prompt)
|
| 114 |
+
placeholder = st.empty()
|
| 115 |
+
full_response = ""
|
| 116 |
+
for item in response:
|
| 117 |
+
full_response += item
|
| 118 |
+
placeholder.markdown(full_response)
|
| 119 |
+
placeholder.markdown(full_response)
|
| 120 |
+
message = {"role": "assistant", "content": full_response}
|
| 121 |
+
st.session_state.messages.append(message)
|
| 122 |
+
|
| 123 |
|
| 124 |
# Generate a new response if the last message is not from the assistant
|
| 125 |
if st.session_state.messages[-1]["role"] != "assistant" and not "image" in st.session_state.messages[-1]["content"].lower():
|