Spaces:
Sleeping
Sleeping
ogegadavis254
commited on
Commit
•
3aacb50
1
Parent(s):
6fcf3cf
Update app.py
Browse files
app.py
CHANGED
@@ -108,29 +108,28 @@ if prompt := st.text_input(f"Hi, I'm {selected_model}, let's chat (Max {max_inpu
|
|
108 |
if len(prompt) > max_input_length:
|
109 |
st.error(f"Maximum input length exceeded. Please limit your input to {max_input_length} characters.")
|
110 |
else:
|
111 |
-
|
112 |
-
|
113 |
-
with st.
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
if
|
129 |
-
if
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
st.session_state.messages.append(("assistant", assistant_response))
|
134 |
|
135 |
# Display conversation insights
|
136 |
st.sidebar.subheader("Conversation Insights")
|
|
|
108 |
if len(prompt) > max_input_length:
|
109 |
st.error(f"Maximum input length exceeded. Please limit your input to {max_input_length} characters.")
|
110 |
else:
|
111 |
+
if st.button("Send"):
|
112 |
+
with st.spinner("Sending..."):
|
113 |
+
with st.chat_message("user"):
|
114 |
+
st.markdown(prompt)
|
115 |
+
st.session_state.messages.append(("user", prompt))
|
116 |
+
|
117 |
+
# Interact with the selected model
|
118 |
+
assistant_response = interact_with_together_api(st.session_state.messages, model_links[selected_model])
|
119 |
+
|
120 |
+
if assistant_response is not None:
|
121 |
+
with st.empty():
|
122 |
+
st.markdown("AI is typing...")
|
123 |
+
st.empty()
|
124 |
+
with st.chat_message("assistant"):
|
125 |
+
st.markdown(assistant_response)
|
126 |
+
|
127 |
+
if any(keyword in prompt.lower() for keyword in ["human", "therapist", "someone", "died", "death", "help", "suicide", "suffering", "crisis", "emergency", "support", "depressed", "anxiety", "lonely", "desperate", "struggling", "counseling", "distressed", "hurt", "pain", "grief", "trauma", "abuse", "danger", "risk", "urgent", "need assistance"]):
|
128 |
+
if not st.session_state.ask_intervention:
|
129 |
+
if st.button("After the analyzing our session you may need some extra help, so you can reach out to a certified therapist at +25493609747 Name: Ogega feel free to talk"):
|
130 |
+
st.write("You can reach out to a certified therapist at +25493609747.")
|
131 |
+
|
132 |
+
st.session_state.messages.append(("assistant", assistant_response))
|
|
|
133 |
|
134 |
# Display conversation insights
|
135 |
st.sidebar.subheader("Conversation Insights")
|