Skip to content

Commit a993228

Browse files
authored
Merge pull request #19 from shviam-2018/development-stage
Development stage [major update]
2 parents d9d806c + 1254713 commit a993228

File tree

6 files changed

+192
-10
lines changed

6 files changed

+192
-10
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
Welcome to Thea, your virtual companion on the path to emotional well-being! Thea is an artificial intelligence therapist implemented in Python, designed to simulate the empathetic and understanding qualities of a real-life therapist. With a focus on continuous learning and personalized interactions, Thea aims to create a supportive environment for users seeking emotional guidance.
44

5+
# Disclaimer
6+
Before proceeding, it is crucial to note that Thea is an AI therapist designed to provide support and companionship. However, it is not a substitute for professional mental health care. If you are experiencing severe distress or have suicidal thoughts, please seek immediate help from a mental health professional or contact a helpline in your region.
7+
8+
The Thea development team emphasizes that while Thea aims to be supportive, it is not a licensed therapist. The AI is continually learning and evolving, and your feedback is valuable for its improvement. The Thea team does not take responsibility for any harm caused by the program; use it at your own risk.
9+
510
## Features
611

712
- **Dynamic Learning:** Thea evolves over time, learning from user interactions to enhance the quality of responses.

code/__pycache__/mood.cpython-310.pyc

9.14 KB
Binary file not shown.

code/__pycache__/mood.cpython-312.pyc

-6.65 KB
Binary file not shown.

code/main.py

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import datetime
22
import speech_recognition as sr
33
import pyttsx3
4-
from mood import happy_list, sad_list, angry_list, depressed_list, happy_mood_responses, sad_mood_responses, angry_mood_responses, depressed_mood_responses, general_response
4+
from mood import (happy_list, sad_list, angry_list, depressed_list, suicidal_list, happy_mood_responses, sad_mood_responses, angry_mood_responses, depressed_mood_responses, suicidal_mood_responses, general_responses)
55

66
# Initialize the text-to-speech engine
77
engine = pyttsx3.init("sapi5")
88
voices = engine.getProperty("voices")
9-
engine.setProperty("voice", voices[0].id)
9+
engine.setProperty("voice", voices[1].id)
1010

1111
# Function to speak the given audio
1212
def speak(audio):
@@ -34,13 +34,30 @@ def speak_and_print(message):
3434
print(message)
3535
speak(message)
3636

37-
# Ask for the user's name and start the therapy session
38-
speak_and_print("Before we start today, please state your name for easy communication")
37+
# Ask for the user's name and start the therapy session and desclaimer that say this is Not a real therapist just a script
38+
while True:
39+
speak_and_print("Before we proceed, please note that Thea is an AI therapist designed to provide support and companionship. It is not a substitute for professional mental health care. If you are experiencing severe distress or have suicidal thoughts, please seek immediate help from a mental health professional or contact a helpline in your region.")
40+
41+
speak_and_print("The Thea development team emphasizes that while Thea aims to be supportive, it is not a licensed therapist. The AI is continually learning and evolving, and your feedback is valuable for its improvement. The Thea team does not take responsibility for any harm caused by the program; use it at your own risk.")
42+
43+
disclaimer = "If you understand that Thea is not a real therapist and you have read and understood the disclaimer, please type 'thea is not a real therapist and i have read and understood the disclaimer': "
44+
45+
46+
speak_and_print(disclaimer)
47+
user_agree = input("type hear: ").lower()
48+
49+
if user_agree == "thea is not a real therapist and i have read and understood the disclaimer":
50+
break # Break out of the loop if the user agrees
51+
elif user_agree == "admin code 110308":
52+
break
53+
54+
# Proceed with the therapy session
55+
speak_and_print("Now, please state your name for easy communication")
3956
name = input("Your Name: ")
40-
print(name)
4157

42-
print(f"I am Thea, your therapist for today, {name}. Let's start. How are you feeling today?")
43-
speak(f"I am Thea, your therapist for today, {name}. Let's start. How are you feeling today?")
58+
59+
print(f"I am Thea, your therapist for today, {name} remember that you can end the session whenever you what by saying `ok, thank you for the session` to . Let's start. How are you feeling today?")
60+
speak(f"I am Thea, your therapist for today, {name} remember that you can end the session whenever you what by saying `ok, thank you for the session` to . Let's start. How are you feeling today")
4461

4562
# Function to take microphone input and return string output
4663
def takecommand():
@@ -78,5 +95,11 @@ def takecommand():
7895
elif any(word in user_statement for word in depressed_list):
7996
depressed_mood_responses()
8097

81-
else:
82-
general_response()
98+
elif any(word in user_statement for word in suicidal_list):
99+
suicidal_mood_responses()
100+
101+
elif user_statement == "ok, thank you for the session":
102+
speak_and_print("Ok, then see you next time")
103+
104+
if all(word not in user_statement for word in happy_list + sad_list + angry_list + depressed_list + suicidal_list):
105+
general_responses()

code/mood.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def speak(audio):
1818

1919
depressed_list = ["depressed", "downhearted", "melancholic", "disheartened", "blue", "low", "despondent", "despairing", "dismal", "gloomy", "forlorn", "sorrowful", "mournful", "wretched", "hopeless", "discouraged", "downtrodden", "disconsolate", "downcast", "miserable", "heavy-hearted", "sad", "unhappy", "glum", "joyless", "lugubrious", "morose", "somber", "sullen", "woeful", "tearful", "weepy", "weeping", "sulky", "pessimistic", "defeated", "crestfallen", "brokenhearted", "dejected", "desolate", "heartbroken", "inconsolable", "morbid", "unconsolable"]
2020

21+
suicidal_list = ["suicidal", "hopeless", "desperate", "worthless", "overwhelmed", "lost", "trapped", "unbearable", "broken", "alone", "helpless", "painful", "endless", "darkness", "ending it", "ending my life", "cannot go on", "no way out", "giving up", "life is meaningless", "thinking of suicide", "suicide thoughts", "ending it all", "just want it to stop", "can't go on", "want to die", "don't want to live", "no reason to live", "wish I were dead", "I'm a burden", "tired of life", "nothing to live for", "fade away", "wish it would end", "permanent solution", "escape the pain", "end the suffering", "last resort"]
2122

2223
# def for mood specificy responses
2324
def happy_mood_responses():
@@ -115,7 +116,25 @@ def depressed_mood_responses():
115116
print(f"Thea: {response}")
116117
speak(response)
117118

118-
def general_response():
119+
def suicidal_mood_responses():
120+
responses = [
121+
"I'm really sorry to hear that you're feeling this way. It's important to talk to someone who can provide support.",
122+
"It's okay to ask for help. Consider reaching out to a friend, family member, or mental health professional.",
123+
"You're not alone. Many people care about you, and there are resources available to support you.",
124+
"Please don't hesitate to talk to someone you trust about your feelings. They may be able to offer assistance and comfort.",
125+
"I'm here for you, but it's crucial to connect with those who can provide immediate help. Consider contacting a helpline or a mental health professional.",
126+
"Remember, your feelings are valid, and seeking help is a sign of strength.",
127+
"Even in the darkest moments, there is hope. Reach out to someone you trust and let them support you.",
128+
"Taking the first step to talk about your feelings is a brave and important decision. You're not alone on this journey.",
129+
"Your well-being matters, and there are people who want to help. Consider speaking to a mental health professional for guidance.",
130+
"It's important to prioritize your safety. Connect with someone you trust or a mental health professional as soon as possible.",
131+
"If you're struggling, please don't face it alone. Reach out to someone who cares about you or contact a mental health helpline.",
132+
]
133+
responses = random.choice(responses)
134+
print(f"Thea: {responses}")
135+
speak(responses)
136+
137+
def general_responses():
119138
responses = [
120139
"Okay, can you tell me more?",
121140
"I'm here to listen. Please share more.",

requirements.txt

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
anyio==4.1.0
2+
argon2-cffi==23.1.0
3+
argon2-cffi-bindings==21.2.0
4+
arrow==1.3.0
5+
asttokens==2.4.1
6+
async-lru==2.0.4
7+
attrs==23.1.0
8+
Babel==2.13.1
9+
beautifulsoup4==4.12.2
10+
bleach==6.1.0
11+
certifi==2023.11.17
12+
cffi==1.16.0
13+
charset-normalizer==3.3.2
14+
colorama==0.4.6
15+
comm==0.2.0
16+
contourpy==1.2.0
17+
cycler==0.12.1
18+
debugpy==1.8.0
19+
decorator==5.1.1
20+
defusedxml==0.7.1
21+
exceptiongroup==1.2.0
22+
executing==2.0.1
23+
fastjsonschema==2.19.0
24+
filelock==3.13.1
25+
fonttools==4.46.0
26+
fqdn==1.5.1
27+
fsspec==2023.12.1
28+
gitdb==4.0.11
29+
GitPython==3.1.40
30+
idna==3.6
31+
ipykernel==6.27.1
32+
ipython==8.18.1
33+
isoduration==20.11.0
34+
jedi==0.19.1
35+
Jinja2==3.1.2
36+
joblib==1.3.2
37+
json5==0.9.14
38+
jsonpointer==2.4
39+
jsonschema==4.20.0
40+
jsonschema-specifications==2023.11.2
41+
jupyter-events==0.9.0
42+
jupyter-lsp==2.2.1
43+
jupyter-server-mathjax==0.2.6
44+
jupyter_client==8.6.0
45+
jupyter_core==5.5.0
46+
jupyter_server==2.12.1
47+
jupyter_server_terminals==0.4.4
48+
jupyterlab==4.0.9
49+
jupyterlab_git==0.50.0
50+
jupyterlab_pygments==0.3.0
51+
jupyterlab_server==2.25.2
52+
kiwisolver==1.4.5
53+
MarkupSafe==2.1.3
54+
matplotlib==3.8.2
55+
matplotlib-inline==0.1.6
56+
mistune==3.0.2
57+
mpmath==1.3.0
58+
nbclient==0.9.0
59+
nbconvert==7.12.0
60+
nbdime==4.0.1
61+
nbformat==5.9.2
62+
nest-asyncio==1.5.8
63+
networkx==3.2.1
64+
notebook_shim==0.2.3
65+
numpy==1.26.2
66+
nvidia-cublas-cu12==12.1.3.1
67+
nvidia-cuda-cupti-cu12==12.1.105
68+
nvidia-cuda-nvrtc-cu12==12.1.105
69+
nvidia-cuda-runtime-cu12==12.1.105
70+
nvidia-cudnn-cu12==8.9.2.26
71+
nvidia-cufft-cu12==11.0.2.54
72+
nvidia-curand-cu12==10.3.2.106
73+
nvidia-cusolver-cu12==11.4.5.107
74+
nvidia-cusparse-cu12==12.1.0.106
75+
nvidia-nccl-cu12==2.18.1
76+
nvidia-nvjitlink-cu12==12.3.101
77+
nvidia-nvtx-cu12==12.1.105
78+
overrides==7.4.0
79+
packaging==23.2
80+
pandas==2.1.3
81+
pandocfilters==1.5.0
82+
parso==0.8.3
83+
pexpect==4.9.0
84+
Pillow==10.1.0
85+
platformdirs==4.1.0
86+
plotly==5.18.0
87+
prometheus-client==0.19.0
88+
prompt-toolkit==3.0.41
89+
psutil==5.9.6
90+
ptyprocess==0.7.0
91+
pure-eval==0.2.2
92+
pycparser==2.21
93+
Pygments==2.17.2
94+
pyparsing==3.1.1
95+
python-dateutil==2.8.2
96+
python-json-logger==2.0.7
97+
pyttsx3==2.90
98+
pytz==2023.3.post1
99+
PyYAML==6.0.1
100+
pyzmq==25.1.2
101+
referencing==0.32.0
102+
requests==2.31.0
103+
rfc3339-validator==0.1.4
104+
rfc3986-validator==0.1.1
105+
rpds-py==0.13.2
106+
scikit-learn==1.3.2
107+
scipy==1.11.4
108+
seaborn==0.13.0
109+
Send2Trash==1.8.2
110+
six==1.16.0
111+
smmap==5.0.1
112+
sniffio==1.3.0
113+
soupsieve==2.5
114+
SpeechRecognition==3.10.1
115+
stack-data==0.6.3
116+
sympy==1.12
117+
tenacity==8.2.3
118+
terminado==0.18.0
119+
threadpoolctl==3.2.0
120+
tinycss2==1.2.1
121+
tomli==2.0.1
122+
torch==2.1.1
123+
tornado==6.4
124+
traitlets==5.14.0
125+
triton==2.1.0
126+
types-python-dateutil==2.8.19.14
127+
typing_extensions==4.8.0
128+
tzdata==2023.3
129+
uri-template==1.3.0
130+
urllib3==2.0.7
131+
wcwidth==0.2.12
132+
webcolors==1.13
133+
webencodings==0.5.1
134+
websocket-client==1.7.0
135+
comtypes

0 commit comments

Comments
 (0)