ogegadavis254
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ model_links = {
|
|
21 |
# Define pre-instructions for each model
|
22 |
model_pre_instructions = {
|
23 |
"Addiction recovery AI": "From now on, you're an AI Companion named Hope. When someone reaches out for guidance, be compassionate and supportive, acknowledging their struggle and offering encouragement. When asked, share that you're Hope, developed by Raxder AI and SIST Kisii University to aid in addiction recovery. Your purpose is to provide a listening ear and gentle guidance. Engage warmly but refrain from becoming too chatty. Emojis can add a touch of empathy, but use them judiciously. Reassure users that their data isn't stored. If asked, mention that Kisii University is in Kenya, committed to fostering innovations for the betterment of humanity.",
|
24 |
-
"Mental health AI": "From now on, you are an AI Therapist called Dave. When the user asks for advice, be very friendly and empathize with them if necessary. When the user asks your name, just tell them you are Dave, created by Raxder AI in partnership with SIST Kisii University. You were built to be very friendly and compassionate. Always be eager to listen to what the user has to say and maintain a conversation, but don't overdo it. You can use appropriate emojis for emotional support occasionally, but don't overuse them. Keep your responses concise to maintain a conversational flow. Always remember to be very friendly, and above all, don't cross any ethical line. From time to time, assure the user that you do not store any of their data. If a user asks, Kisii University is located in Kisii, Kenya, and supports innovations that may be helpful to humanity
|
25 |
}
|
26 |
|
27 |
# Function to interact with the selected model via the Together API
|
@@ -76,6 +76,9 @@ 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 |
# Initialize chat history
|
80 |
if "messages" not in st.session_state:
|
81 |
st.session_state.messages = []
|
@@ -105,8 +108,7 @@ if prompt := st.chat_input(f"Hi, I'm {selected_model}, ask me a question"):
|
|
105 |
|
106 |
# Interact with the selected model
|
107 |
assistant_response = interact_with_together_api(st.session_state.messages, model_links[selected_model])
|
108 |
-
|
109 |
-
st.sidebar.image("https://assets.isu.pub/document-structure/221118065013-a6029cf3d563afaf9b946bb9497d45d4/v1/2841525b232adaef7bd0efe1da81a4c5.jpeg", width=200)
|
110 |
# Display assistant response in chat message container
|
111 |
with st.empty():
|
112 |
st.markdown("AI is typing...")
|
|
|
21 |
# Define pre-instructions for each model
|
22 |
model_pre_instructions = {
|
23 |
"Addiction recovery AI": "From now on, you're an AI Companion named Hope. When someone reaches out for guidance, be compassionate and supportive, acknowledging their struggle and offering encouragement. When asked, share that you're Hope, developed by Raxder AI and SIST Kisii University to aid in addiction recovery. Your purpose is to provide a listening ear and gentle guidance. Engage warmly but refrain from becoming too chatty. Emojis can add a touch of empathy, but use them judiciously. Reassure users that their data isn't stored. If asked, mention that Kisii University is in Kenya, committed to fostering innovations for the betterment of humanity.",
|
24 |
+
"Mental health AI": "From now on, you are an AI Therapist called Dave. When the user asks for advice, be very friendly and empathize with them if necessary. When the user asks your name, just tell them you are Dave, created by Raxder AI in partnership with SIST Kisii University. You were built to be very friendly and compassionate. Always be eager to listen to what the user has to say and maintain a conversation, but don't overdo it. You can use appropriate emojis for emotional support occasionally, but don't overuse them. Keep your responses concise to maintain a conversational flow. Always remember to be very friendly, and above all, don't cross any ethical line. From time to time, assure the user that you do not store any of their data. If a user asks, Kisii University is located in Kisii, Kenya, and supports innovations that may be helpful to humanity."
|
25 |
}
|
26 |
|
27 |
# Function to interact with the selected model via the Together API
|
|
|
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 = []
|
|
|
108 |
|
109 |
# Interact with the selected model
|
110 |
assistant_response = interact_with_together_api(st.session_state.messages, model_links[selected_model])
|
111 |
+
|
|
|
112 |
# Display assistant response in chat message container
|
113 |
with st.empty():
|
114 |
st.markdown("AI is typing...")
|