ogegadavis254 commited on
Commit
3aacb50
1 Parent(s): 6fcf3cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -23
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
- with st.empty():
112
- if st.button("Send"):
113
- with st.spinner("Sending..."):
114
- with st.chat_message("user"):
115
- st.markdown(prompt)
116
- st.session_state.messages.append(("user", prompt))
117
-
118
- # Interact with the selected model
119
- assistant_response = interact_with_together_api(st.session_state.messages, model_links[selected_model])
120
-
121
- if assistant_response is not None:
122
- with st.empty():
123
- st.markdown("AI is typing...")
124
- st.empty()
125
- with st.chat_message("assistant"):
126
- st.markdown(assistant_response)
127
-
128
- 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"]):
129
- if not st.session_state.ask_intervention:
130
- 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"):
131
- st.write("You can reach out to a certified therapist at +25493609747.")
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")