Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,14 @@ user_input = st.text_area("How are you feeling today?", "")
|
|
| 21 |
|
| 22 |
# Display chatbot's response
|
| 23 |
if st.button("Send"):
|
| 24 |
-
if user_input:
|
| 25 |
# Construct the message to instruct the model to behave like a therapist
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
# Get the response from the model
|
| 34 |
response = chatbot(prompt, max_length=300, num_return_sequences=1)[0]['generated_text']
|
|
@@ -36,4 +36,4 @@ if st.button("Send"):
|
|
| 36 |
# Show the response
|
| 37 |
st.text_area("AI Companion Response:", response, height=200)
|
| 38 |
else:
|
| 39 |
-
st.warning("Please enter something to continue the conversation.")
|
|
|
|
| 21 |
|
| 22 |
# Display chatbot's response
|
| 23 |
if st.button("Send"):
|
| 24 |
+
if user_input: # Check if the user has provided input
|
| 25 |
# Construct the message to instruct the model to behave like a therapist
|
| 26 |
+
prompt = f"""
|
| 27 |
+
You are a therapist with a strong focus on providing practical, actionable advice.
|
| 28 |
+
Respond in a supportive, empathetic, and non-judgmental manner to the following statement.
|
| 29 |
+
Offer at least 2-3 **specific** strategies or coping techniques the user can try immediately to manage or alleviate the emotion they are feeling.
|
| 30 |
+
Include emotional regulation techniques, self-care practices, or mindset shifts: {user_input}
|
| 31 |
+
"""
|
| 32 |
|
| 33 |
# Get the response from the model
|
| 34 |
response = chatbot(prompt, max_length=300, num_return_sequences=1)[0]['generated_text']
|
|
|
|
| 36 |
# Show the response
|
| 37 |
st.text_area("AI Companion Response:", response, height=200)
|
| 38 |
else:
|
| 39 |
+
st.warning("Please enter something to continue the conversation.")
|