Spaces:
Sleeping
Sleeping
ogegadavis254
commited on
Commit
•
4f4ef99
1
Parent(s):
8ccf576
Update app.py
Browse files
app.py
CHANGED
@@ -76,14 +76,15 @@ st.sidebar.button('Reset Chat', on_click=reset_conversation)
|
|
76 |
# Add cautionary message about testing phase at the bottom of the sidebar
|
77 |
st.sidebar.markdown("**Note**: This model is still in the testing phase. Responses may be inaccurate or undesired. Use it cautiously, especially for critical issues.")
|
78 |
|
79 |
-
# Add logo to the sidebar
|
80 |
st.sidebar.image("https://assets.isu.pub/document-structure/221118065013-a6029cf3d563afaf9b946bb9497d45d4/v1/2841525b232adaef7bd0efe1da81a4c5.jpeg", width=200)
|
|
|
81 |
|
82 |
# Initialize chat history
|
83 |
if "messages" not in st.session_state:
|
84 |
st.session_state.messages = []
|
85 |
st.session_state.message_count = 0
|
86 |
-
st.session_state.
|
87 |
|
88 |
# Display chat messages from history on app rerun
|
89 |
for message in st.session_state.messages:
|
@@ -99,12 +100,12 @@ if prompt := st.chat_input(f"Hi, I'm {selected_model}, ask me a question"):
|
|
99 |
st.session_state.messages.append(("user", prompt))
|
100 |
st.session_state.message_count += 1
|
101 |
|
102 |
-
# Check if
|
103 |
-
if
|
104 |
-
if st.
|
105 |
-
st.
|
106 |
-
|
107 |
-
|
108 |
|
109 |
# Interact with the selected model
|
110 |
assistant_response = interact_with_together_api(st.session_state.messages, model_links[selected_model])
|
|
|
76 |
# Add cautionary message about testing phase at the bottom of the sidebar
|
77 |
st.sidebar.markdown("**Note**: This model is still in the testing phase. Responses may be inaccurate or undesired. Use it cautiously, especially for critical issues.")
|
78 |
|
79 |
+
# Add logo and text to the sidebar
|
80 |
st.sidebar.image("https://assets.isu.pub/document-structure/221118065013-a6029cf3d563afaf9b946bb9497d45d4/v1/2841525b232adaef7bd0efe1da81a4c5.jpeg", width=200)
|
81 |
+
st.sidebar.write("A product of Kisii University")
|
82 |
|
83 |
# Initialize chat history
|
84 |
if "messages" not in st.session_state:
|
85 |
st.session_state.messages = []
|
86 |
st.session_state.message_count = 0
|
87 |
+
st.session_state.ask_intervention = False
|
88 |
|
89 |
# Display chat messages from history on app rerun
|
90 |
for message in st.session_state.messages:
|
|
|
100 |
st.session_state.messages.append(("user", prompt))
|
101 |
st.session_state.message_count += 1
|
102 |
|
103 |
+
# Check if intervention is needed
|
104 |
+
if "suicide" in prompt.lower() or "help" in prompt.lower():
|
105 |
+
if not st.session_state.ask_intervention:
|
106 |
+
if st.button("Do you need to talk to a therapist?"):
|
107 |
+
st.session_state.ask_intervention = True
|
108 |
+
st.write("You can reach out to a certified therapist at +25493609747.")
|
109 |
|
110 |
# Interact with the selected model
|
111 |
assistant_response = interact_with_together_api(st.session_state.messages, model_links[selected_model])
|