harshnarayan12
commited on
Upload 15 files
Browse filesβ’ Here , we developed a web app for visitors. So, they know their Mental Health Staus.
β’ We took survey on google form and pre-processed data. We tried differnt ML models,
but ANN Regressor (With 73% test accuracy) perform decent and better from all different models which we tried.
β’ Interested to know your mental health status !!!
- .gitignore +2 -0
- Developer activity-pana.png +0 -0
- Dockerfile +21 -0
- Financial data-rafiki.png +0 -0
- Mental health-pana.png +0 -0
- Pages/About.py +137 -0
- Pages/Prediction.py +859 -0
- README.md +3 -10
- Report-pana.png +0 -0
- Schizophrenia-pana.png +0 -0
- Standup meeting-pana.png +0 -0
- app.py +147 -0
- requirements.txt +0 -0
- train.h5 +3 -0
- train.pkl +3 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
logs.log
|
2 |
+
MentalHealth
|
Developer activity-pana.png
ADDED
Dockerfile
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# for render
|
2 |
+
|
3 |
+
# FROM python:3.10
|
4 |
+
# COPY . /app
|
5 |
+
# WORKDIR /app
|
6 |
+
# RUN pip install --no-cache-dir -r requirements.txt
|
7 |
+
# EXPOSE 8501
|
8 |
+
# CMD streamlit run app.py --server.port $PORT
|
9 |
+
|
10 |
+
# for hugging face
|
11 |
+
FROM python:3.10
|
12 |
+
|
13 |
+
WORKDIR /code
|
14 |
+
|
15 |
+
COPY ./requirements.txt /code/requirements.txt
|
16 |
+
|
17 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
18 |
+
|
19 |
+
COPY . .
|
20 |
+
|
21 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
Financial data-rafiki.png
ADDED
Mental health-pana.png
ADDED
Pages/About.py
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
st.set_page_config(
|
4 |
+
page_title="About US",
|
5 |
+
page_icon="π",
|
6 |
+
layout="wide",
|
7 |
+
initial_sidebar_state="expanded",
|
8 |
+
)
|
9 |
+
page_bg_img_link = f"""
|
10 |
+
<style>
|
11 |
+
[data-testid="stAppViewContainer"]> .main{{
|
12 |
+
|
13 |
+
# background-image: url(https://www.orfonline.org/wp-content/uploads/2022/10/mental-health-wellness-during-covid-19.jpg);
|
14 |
+
# background-size:cover;
|
15 |
+
# background-position: left;
|
16 |
+
# background-repeat:no-repeat;
|
17 |
+
# background-attachment:local;
|
18 |
+
background-color: #FFDEE9;
|
19 |
+
background-image: linear-gradient(0deg, #FFDEE9 0%, #B5FFFC 100%);
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
}}
|
25 |
+
|
26 |
+
|
27 |
+
[data-testid="stHeader"]{{
|
28 |
+
background-color: rgba(0,0,0,0)
|
29 |
+
|
30 |
+
}}
|
31 |
+
|
32 |
+
[data-testid="stToolbar"]{{
|
33 |
+
right : 2 rem;
|
34 |
+
}}
|
35 |
+
|
36 |
+
[data-testid="stSidebar"] > div:first-child{{
|
37 |
+
|
38 |
+
|
39 |
+
background: linear-gradient(to right bottom,
|
40 |
+
rgba(255,225,225,0.7),
|
41 |
+
rgba(255,225,225,0.3));
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
}}
|
46 |
+
|
47 |
+
[data-testid="stMarkdownContainer"] {{
|
48 |
+
display: flex;
|
49 |
+
justify-content: center;
|
50 |
+
align-items: center;
|
51 |
+
|
52 |
+
|
53 |
+
}}
|
54 |
+
|
55 |
+
[data-testid="stMarkdownContainer"] > p > a > img {{
|
56 |
+
height : 30px;
|
57 |
+
|
58 |
+
|
59 |
+
}}
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
</style>
|
64 |
+
"""
|
65 |
+
st.markdown(page_bg_img_link, unsafe_allow_html=True)
|
66 |
+
with st.sidebar:
|
67 |
+
# st.markdown(
|
68 |
+
# '<div style=" font-family: Mali, cursive;text-align: center; font-size:30px; color:#ff725e; margin :10px">Mental Health</div>',
|
69 |
+
# unsafe_allow_html=True,
|
70 |
+
# )
|
71 |
+
|
72 |
+
st.image(
|
73 |
+
"Mental health-pana.png",
|
74 |
+
width=320,
|
75 |
+
)
|
76 |
+
|
77 |
+
|
78 |
+
def about_page():
|
79 |
+
title = st.markdown(
|
80 |
+
'<div style=" font-family: Mali, cursive;text-align: center; font-size:3.5rem; color: rgb(69, 90, 100); margin-bottom :20px">About Us</div>',
|
81 |
+
unsafe_allow_html=True,
|
82 |
+
)
|
83 |
+
|
84 |
+
st.markdown(
|
85 |
+
'<div style=" font-family: Mali, cursive; font-size:20px; color:black;">We are the students of M.Sc Data Science . We developed this web application by sharing each others knowledge and working together as a team.</div>',
|
86 |
+
unsafe_allow_html=True,
|
87 |
+
)
|
88 |
+
st.markdown("""---""")
|
89 |
+
|
90 |
+
with st.container():
|
91 |
+
col = st.columns([1, 1, 1])
|
92 |
+
# HARSH #
|
93 |
+
with col[1]:
|
94 |
+
st.image("Developer activity-pana.png")
|
95 |
+
st.markdown(
|
96 |
+
'<div style=" font-family: Mali, cursive;text-align: center; font-size:24px; color:black;">Harsh Narayan</div>',
|
97 |
+
unsafe_allow_html=True,
|
98 |
+
)
|
99 |
+
# st.markdown(
|
100 |
+
# '<div style=" font-family: Mali, cursive;text-align: center; font-size:16px; color:black;">Masters in Data Science</div>',
|
101 |
+
# unsafe_allow_html=True,
|
102 |
+
# )
|
103 |
+
st.markdown(
|
104 |
+
"[![My Skills](https://skillicons.dev/icons?i=linkedin)](https://www.linkedin.com/in/harsh-narayan-377907264/)"
|
105 |
+
)
|
106 |
+
# SHAMEEK #
|
107 |
+
with col[1]:
|
108 |
+
st.image("Standup meeting-pana.png")
|
109 |
+
st.markdown(
|
110 |
+
'<div style=" font-family: Mali, cursive;text-align: center; font-size:24px; color:black;">Shameek Bhowmick</div>',
|
111 |
+
unsafe_allow_html=True,
|
112 |
+
)
|
113 |
+
# st.markdown(
|
114 |
+
# '<div style=" font-family: Mali, cursive;text-align: center; font-size:16px; color:black;">Masters in Data Science</div>',
|
115 |
+
# unsafe_allow_html=True,
|
116 |
+
# )
|
117 |
+
st.markdown(
|
118 |
+
"[![My Skills](https://skillicons.dev/icons?i=linkedin)](https://www.linkedin.com/in/shameek-bhowmick-3481131a8/)"
|
119 |
+
)
|
120 |
+
# SAKSHI #
|
121 |
+
with col[2]:
|
122 |
+
st.image("Report-pana.png")
|
123 |
+
st.markdown(
|
124 |
+
'<div style=" font-family: Mali, cursive;text-align: center; font-size:24px; color:black;">Sakshi Panhalkar</div>',
|
125 |
+
unsafe_allow_html=True,
|
126 |
+
)
|
127 |
+
# st.markdown(
|
128 |
+
# '<div style=" font-family: Mali, cursive;text-align: center; font-size:16px; color:black;">Masters in Data Science</div>',
|
129 |
+
# unsafe_allow_html=True,
|
130 |
+
# )
|
131 |
+
st.markdown(
|
132 |
+
"[![My Skills](https://skillicons.dev/icons?i=linkedin)](https://www.linkedin.com/in/sakshi-panhalkar-7188061b4/)"
|
133 |
+
)
|
134 |
+
|
135 |
+
|
136 |
+
if __name__ == "__main__":
|
137 |
+
about_page()
|
Pages/Prediction.py
ADDED
@@ -0,0 +1,859 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
import os
|
4 |
+
import numpy as np
|
5 |
+
import pandas as pd
|
6 |
+
|
7 |
+
|
8 |
+
import tensorflow as tf
|
9 |
+
|
10 |
+
|
11 |
+
st.set_page_config(
|
12 |
+
page_title="prediction",
|
13 |
+
page_icon="π",
|
14 |
+
layout="wide",
|
15 |
+
initial_sidebar_state="expanded",
|
16 |
+
)
|
17 |
+
|
18 |
+
page_bg_img_link = f"""
|
19 |
+
<style>
|
20 |
+
[data-testid="stAppViewContainer"]> .main{{
|
21 |
+
|
22 |
+
# background-image: url(https://www.orfonline.org/wp-content/uploads/2022/10/mental-health-wellness-during-covid-19.jpg);
|
23 |
+
# background-size:cover;
|
24 |
+
# background-position: left;
|
25 |
+
# background-repeat:no-repeat;
|
26 |
+
# background-attachment:local;
|
27 |
+
background-color: #FFDEE9;
|
28 |
+
background-image: linear-gradient(0deg, #FFDEE9 0%, #B5FFFC 100%);
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
}}
|
34 |
+
|
35 |
+
|
36 |
+
[data-testid="stHeader"]{{
|
37 |
+
background-color: rgba(0,0,0,0)
|
38 |
+
|
39 |
+
}}
|
40 |
+
|
41 |
+
[data-testid="stToolbar"]{{
|
42 |
+
right : 2 rem;
|
43 |
+
}}
|
44 |
+
|
45 |
+
[data-testid="stSidebar"] > div:first-child{{
|
46 |
+
|
47 |
+
|
48 |
+
background: linear-gradient(to right bottom,
|
49 |
+
rgba(255,225,225,0.7),
|
50 |
+
rgba(255,225,225,0.3));
|
51 |
+
}}
|
52 |
+
|
53 |
+
[data-baseweb="tab-list"]{{
|
54 |
+
display : flex ;
|
55 |
+
justify-content:center;
|
56 |
+
gap:3rem;
|
57 |
+
|
58 |
+
border-radius: 15px;
|
59 |
+
background-color: hsla(7.2, 100%, 77.1%, 0.62);
|
60 |
+
|
61 |
+
}}
|
62 |
+
|
63 |
+
[data-testid="stMarkdownContainer"] > p {{
|
64 |
+
color : black;
|
65 |
+
font-size:16px;
|
66 |
+
font-family: Open Sans, sans-serif;
|
67 |
+
}}
|
68 |
+
|
69 |
+
[data-testid="baseButton-secondary" ] {{
|
70 |
+
background-color: white;
|
71 |
+
}}
|
72 |
+
</style>
|
73 |
+
"""
|
74 |
+
st.markdown(page_bg_img_link, unsafe_allow_html=True)
|
75 |
+
|
76 |
+
with st.sidebar:
|
77 |
+
# st.markdown(
|
78 |
+
# '<div style=" font-family: Mali, cursive;text-align: center; font-size:30px; color:#ff725e; margin :10px">Mental Health</div>',
|
79 |
+
# unsafe_allow_html=True,
|
80 |
+
# )
|
81 |
+
|
82 |
+
st.image(
|
83 |
+
"Mental health-pana.png",
|
84 |
+
width=320,
|
85 |
+
)
|
86 |
+
|
87 |
+
|
88 |
+
@st.cache_resource
|
89 |
+
def Load_mode():
|
90 |
+
model = tf.keras.models.load_model("train.h5")
|
91 |
+
return model
|
92 |
+
|
93 |
+
|
94 |
+
# @st.cache_resource
|
95 |
+
# def Load_mode():
|
96 |
+
# with open("train.pkl", "rb") as file:
|
97 |
+
# model = pickle.load(file)
|
98 |
+
# return model
|
99 |
+
|
100 |
+
|
101 |
+
# to play with streamlit css properties we use streamlit coponents
|
102 |
+
|
103 |
+
import streamlit.components.v1 as components
|
104 |
+
|
105 |
+
|
106 |
+
def Prediction():
|
107 |
+
if os.path.exists("Sourcedata.csv"):
|
108 |
+
df = pd.read_csv("Sourcedata.csv", index_col=None)
|
109 |
+
else:
|
110 |
+
df = None
|
111 |
+
title = st.markdown(
|
112 |
+
'<div style=" font-family: Mali, cursive;text-align: center; font-size:3.5rem; color: rgb(69, 90, 100); margin-bottom :4rem; ">Intersted to know Mental Health Status!</div>',
|
113 |
+
unsafe_allow_html=True,
|
114 |
+
)
|
115 |
+
Age = st.slider("What is your age?", 0, 100)
|
116 |
+
# Age = st.number_input("Enter your age!")
|
117 |
+
cols = st.columns([1, 1])
|
118 |
+
with st.container():
|
119 |
+
with cols[0]:
|
120 |
+
Sex = st.radio("Select Gender", ["Male", "Female"])
|
121 |
+
with cols[1]:
|
122 |
+
Location = st.radio("Select your Location", ["Urban", "Rural"])
|
123 |
+
|
124 |
+
with st.container():
|
125 |
+
tab1, tab2, tab3, tab4, tab5 = st.tabs(
|
126 |
+
[
|
127 |
+
"Coping Strategies ",
|
128 |
+
"Shyness ",
|
129 |
+
"Loneliness ",
|
130 |
+
"Self Esteem ",
|
131 |
+
"Life satisfaction ",
|
132 |
+
]
|
133 |
+
)
|
134 |
+
with tab1:
|
135 |
+
# Coping Strategies
|
136 |
+
# CS- Self Distraction
|
137 |
+
|
138 |
+
st.markdown(
|
139 |
+
'<div style="margin-top: 40px; color:black; font-size: 1.6rem;font-weight: 300;text-align: left; color:black;">Self Distraction : </div>',
|
140 |
+
unsafe_allow_html=True,
|
141 |
+
)
|
142 |
+
cols = st.columns([1, 1])
|
143 |
+
with st.container():
|
144 |
+
with cols[0]:
|
145 |
+
SD1 = st.radio(
|
146 |
+
"1 - I've been turning to work or other activities to take my mind off things.",
|
147 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
148 |
+
)
|
149 |
+
with cols[1]:
|
150 |
+
SD2 = st.radio(
|
151 |
+
"2 - I've been doing something to think about it less, such as going to movies, watching TV, reading, daydreaming, sleeping or shopping.",
|
152 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
153 |
+
)
|
154 |
+
|
155 |
+
# CS- Denial
|
156 |
+
|
157 |
+
st.markdown(
|
158 |
+
'<div style="margin-top: 40px; color:black; font-size: 1.6rem;font-weight: 300;text-align: left;">Denial : </div>',
|
159 |
+
unsafe_allow_html=True,
|
160 |
+
)
|
161 |
+
cols = st.columns([1, 1])
|
162 |
+
with st.container():
|
163 |
+
with cols[0]:
|
164 |
+
D1 = st.radio(
|
165 |
+
"1 - I've been saying to myself, this isn't real.",
|
166 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
167 |
+
)
|
168 |
+
with cols[1]:
|
169 |
+
D2 = st.radio(
|
170 |
+
"2 - I've been refusing to believe that it has happened.",
|
171 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
172 |
+
)
|
173 |
+
|
174 |
+
# CS - Venting
|
175 |
+
|
176 |
+
st.markdown(
|
177 |
+
'<div style="margin-top: 40px; color:black; font-size: 1.6rem;font-weight: 300;text-align: left;">Venting : </div>',
|
178 |
+
unsafe_allow_html=True,
|
179 |
+
)
|
180 |
+
|
181 |
+
cols = st.columns([1, 1])
|
182 |
+
with st.container():
|
183 |
+
with cols[0]:
|
184 |
+
V1 = st.radio(
|
185 |
+
"1 - I've been saying things to let my unpleasant feelings escape.",
|
186 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
187 |
+
)
|
188 |
+
|
189 |
+
with cols[1]:
|
190 |
+
V2 = st.radio(
|
191 |
+
"2 - I've been expressing my negative feelings.",
|
192 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
193 |
+
)
|
194 |
+
|
195 |
+
# CS - Self-blame
|
196 |
+
|
197 |
+
st.markdown(
|
198 |
+
'<div style="margin-top: 40px; color:black; font-size: 1.6rem;font-weight: 300;text-align: left;">Self-blame : </div>',
|
199 |
+
unsafe_allow_html=True,
|
200 |
+
)
|
201 |
+
|
202 |
+
cols = st.columns([1, 1])
|
203 |
+
with st.container():
|
204 |
+
with cols[0]:
|
205 |
+
SB1 = st.radio(
|
206 |
+
"1 - I've been criticizing myself.",
|
207 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
208 |
+
)
|
209 |
+
with cols[1]:
|
210 |
+
SB2 = st.radio(
|
211 |
+
"2 - I've been blaming myself for things that happened.",
|
212 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
213 |
+
)
|
214 |
+
|
215 |
+
# CS - Behavioural Disengagement
|
216 |
+
|
217 |
+
st.markdown(
|
218 |
+
'<div style="margin-top: 40px; color:black; font-size: 1.6rem;font-weight: 300;text-align: left;">Behavioural Disengagement : </div>',
|
219 |
+
unsafe_allow_html=True,
|
220 |
+
)
|
221 |
+
|
222 |
+
cols = st.columns([1, 1])
|
223 |
+
with st.container():
|
224 |
+
with cols[0]:
|
225 |
+
BD1 = st.radio(
|
226 |
+
"1 - I've been giving up trying to deal with it.",
|
227 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
228 |
+
)
|
229 |
+
with cols[1]:
|
230 |
+
BD2 = st.radio(
|
231 |
+
"2 - I've been giving up the attempt to cope.",
|
232 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
233 |
+
)
|
234 |
+
|
235 |
+
# CS - Acceptance
|
236 |
+
|
237 |
+
st.markdown(
|
238 |
+
'<div style="margin-top: 40px; color:black; font-size: 1.6rem;font-weight: 300;text-align: left;">Acceptance : </div>',
|
239 |
+
unsafe_allow_html=True,
|
240 |
+
)
|
241 |
+
|
242 |
+
cols = st.columns([1, 1])
|
243 |
+
with st.container():
|
244 |
+
with cols[0]:
|
245 |
+
A1 = st.radio(
|
246 |
+
"1 - I've been accepting the reality of the fact that it has happened.",
|
247 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
248 |
+
)
|
249 |
+
with cols[1]:
|
250 |
+
A2 = st.radio(
|
251 |
+
"2 - I've been learning to live with it.",
|
252 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
253 |
+
)
|
254 |
+
|
255 |
+
# cs- Active Coping
|
256 |
+
|
257 |
+
st.markdown(
|
258 |
+
'<div style="margin-top: 40px; color:black; font-size: 1.6rem;font-weight: 300;text-align: left;">Active Coping : </div>',
|
259 |
+
unsafe_allow_html=True,
|
260 |
+
)
|
261 |
+
|
262 |
+
cols = st.columns([1, 1])
|
263 |
+
with st.container():
|
264 |
+
with cols[0]:
|
265 |
+
AC1 = st.radio(
|
266 |
+
"1 - I've been concentrating my efforts on doing something about the situation I'm in.",
|
267 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
268 |
+
)
|
269 |
+
with cols[1]:
|
270 |
+
AC2 = st.radio(
|
271 |
+
"2 - I've been taking action to try to make the situation better.",
|
272 |
+
options=["Never", "Rarely", "Sometimes", "Often", "Very Often"],
|
273 |
+
)
|
274 |
+
with tab2:
|
275 |
+
# Shyness
|
276 |
+
cols = st.columns([1, 1, 1])
|
277 |
+
with st.container():
|
278 |
+
with cols[0]:
|
279 |
+
S1 = st.radio(
|
280 |
+
"1 - I feel tense when I'm with people I don't know.",
|
281 |
+
options=[
|
282 |
+
"Not at all",
|
283 |
+
"Slightly",
|
284 |
+
"Moderately",
|
285 |
+
"Very",
|
286 |
+
"Completely",
|
287 |
+
],
|
288 |
+
)
|
289 |
+
with cols[1]:
|
290 |
+
S2 = st.radio(
|
291 |
+
"2 - I am socially somewhat awkward.",
|
292 |
+
options=[
|
293 |
+
"Not at all",
|
294 |
+
"Slightly",
|
295 |
+
"Moderately",
|
296 |
+
"Very",
|
297 |
+
"Completely",
|
298 |
+
],
|
299 |
+
)
|
300 |
+
with cols[2]:
|
301 |
+
S3 = st.radio(
|
302 |
+
"3 - I am often uncomfortable at parties and other social functions.",
|
303 |
+
options=[
|
304 |
+
"Not at all",
|
305 |
+
"Slightly",
|
306 |
+
"Moderately",
|
307 |
+
"Very",
|
308 |
+
"Completely",
|
309 |
+
],
|
310 |
+
)
|
311 |
+
cols = st.columns([1, 1, 1])
|
312 |
+
with st.container():
|
313 |
+
with cols[0]:
|
314 |
+
S4 = st.radio(
|
315 |
+
"4 - When in a group of people, I have trouble thinking of the right things to talk about.",
|
316 |
+
options=[
|
317 |
+
"Not at all",
|
318 |
+
"Slightly",
|
319 |
+
"Moderately",
|
320 |
+
"Very",
|
321 |
+
"Completely",
|
322 |
+
],
|
323 |
+
)
|
324 |
+
with cols[1]:
|
325 |
+
S5 = st.radio(
|
326 |
+
"5 - It is hard for me to act natural when I am meeting new people.",
|
327 |
+
options=[
|
328 |
+
"Not at all",
|
329 |
+
"Slightly",
|
330 |
+
"Moderately",
|
331 |
+
"Very",
|
332 |
+
"Completely",
|
333 |
+
],
|
334 |
+
)
|
335 |
+
with cols[2]:
|
336 |
+
S6 = st.radio(
|
337 |
+
"6 - I feel nervous when speaking to someone in authority.",
|
338 |
+
options=[
|
339 |
+
"Not at all",
|
340 |
+
"Slightly",
|
341 |
+
"Moderately",
|
342 |
+
"Very",
|
343 |
+
"Completely",
|
344 |
+
],
|
345 |
+
)
|
346 |
+
cols = st.columns([1, 1, 1])
|
347 |
+
with st.container():
|
348 |
+
with cols[0]:
|
349 |
+
S7 = st.radio(
|
350 |
+
"7 - I have trouble looking someone right in the eye.",
|
351 |
+
options=[
|
352 |
+
"Not at all",
|
353 |
+
"Slightly",
|
354 |
+
"Moderately",
|
355 |
+
"Very",
|
356 |
+
"Completely",
|
357 |
+
],
|
358 |
+
)
|
359 |
+
with cols[1]:
|
360 |
+
S8 = st.radio(
|
361 |
+
"8 - I feel inhibited in social situations.",
|
362 |
+
options=[
|
363 |
+
"Not at all",
|
364 |
+
"Slightly",
|
365 |
+
"Moderately",
|
366 |
+
"Very",
|
367 |
+
"Completely",
|
368 |
+
],
|
369 |
+
)
|
370 |
+
with cols[2]:
|
371 |
+
S9 = st.radio(
|
372 |
+
"9 - I am more shy with members of the opposite sex.",
|
373 |
+
options=[
|
374 |
+
"Not at all",
|
375 |
+
"Slightly",
|
376 |
+
"Moderately",
|
377 |
+
"Very",
|
378 |
+
"Completely",
|
379 |
+
],
|
380 |
+
)
|
381 |
+
with tab3:
|
382 |
+
# Loneliness
|
383 |
+
cols = st.columns([1, 1])
|
384 |
+
with st.container():
|
385 |
+
with cols[0]:
|
386 |
+
L1 = st.radio(
|
387 |
+
"1 - I am a lonely person.",
|
388 |
+
options=[
|
389 |
+
"Strongly Disagree",
|
390 |
+
"Disagree",
|
391 |
+
"Neutral",
|
392 |
+
"Agree",
|
393 |
+
"Strongly Agree",
|
394 |
+
],
|
395 |
+
)
|
396 |
+
with cols[1]:
|
397 |
+
L2 = st.radio(
|
398 |
+
"2 - I always will be a lonely person.",
|
399 |
+
options=[
|
400 |
+
"Strongly Disagree",
|
401 |
+
"Disagree",
|
402 |
+
"Neutral",
|
403 |
+
"Agree",
|
404 |
+
"Strongly Agree",
|
405 |
+
],
|
406 |
+
)
|
407 |
+
|
408 |
+
cols = st.columns([1, 1])
|
409 |
+
with st.container():
|
410 |
+
with cols[0]:
|
411 |
+
L3 = st.radio(
|
412 |
+
"3 - Other people think of me as a lonely person.",
|
413 |
+
options=[
|
414 |
+
"Strongly Disagree",
|
415 |
+
"Disagree",
|
416 |
+
"Neutral",
|
417 |
+
"Agree",
|
418 |
+
"Strongly Agree",
|
419 |
+
],
|
420 |
+
)
|
421 |
+
with cols[1]:
|
422 |
+
L4 = st.radio(
|
423 |
+
"4 - I always was a lonely person.",
|
424 |
+
options=[
|
425 |
+
"Strongly Disagree",
|
426 |
+
"Disagree",
|
427 |
+
"Neutral",
|
428 |
+
"Agree",
|
429 |
+
"Strongly Agree",
|
430 |
+
],
|
431 |
+
)
|
432 |
+
with tab4:
|
433 |
+
# Self Esteem
|
434 |
+
cols = st.columns([1, 1, 1])
|
435 |
+
with st.container():
|
436 |
+
with cols[0]:
|
437 |
+
SE1 = st.radio(
|
438 |
+
"1 - On the whole, I am satisfied with myself.",
|
439 |
+
options=[
|
440 |
+
"Strongly Disagree",
|
441 |
+
"Disagree",
|
442 |
+
"Neutral",
|
443 |
+
"Agree",
|
444 |
+
"Strongly Agree",
|
445 |
+
],
|
446 |
+
)
|
447 |
+
with cols[1]:
|
448 |
+
SE2 = st.radio(
|
449 |
+
"2 - I feel that I have a number of good qualities..",
|
450 |
+
options=[
|
451 |
+
"Strongly Disagree",
|
452 |
+
"Disagree",
|
453 |
+
"Neutral",
|
454 |
+
"Agree",
|
455 |
+
"Strongly Agree",
|
456 |
+
],
|
457 |
+
)
|
458 |
+
with cols[2]:
|
459 |
+
SE3 = st.radio(
|
460 |
+
"3 - I am able to do things as well as most other people.",
|
461 |
+
options=[
|
462 |
+
"Strongly Disagree",
|
463 |
+
"Disagree",
|
464 |
+
"Neutral",
|
465 |
+
"Agree",
|
466 |
+
"Strongly Agree",
|
467 |
+
],
|
468 |
+
)
|
469 |
+
cols = st.columns([1, 1, 1])
|
470 |
+
with st.container():
|
471 |
+
with cols[0]:
|
472 |
+
SE4 = st.radio(
|
473 |
+
"4 - I feel that I'm a person of worth, at least on an equal plane with others.",
|
474 |
+
options=[
|
475 |
+
"Strongly Disagree",
|
476 |
+
"Disagree",
|
477 |
+
"Neutral",
|
478 |
+
"Agree",
|
479 |
+
"Strongly Agree",
|
480 |
+
],
|
481 |
+
)
|
482 |
+
with cols[1]:
|
483 |
+
SE5 = st.radio(
|
484 |
+
"5 - I take positive attitude toward myself.",
|
485 |
+
options=[
|
486 |
+
"Strongly Disagree",
|
487 |
+
"Disagree",
|
488 |
+
"Neutral",
|
489 |
+
"Agree",
|
490 |
+
"Strongly Agree",
|
491 |
+
],
|
492 |
+
)
|
493 |
+
|
494 |
+
with tab5:
|
495 |
+
# Life satisfaction
|
496 |
+
cols = st.columns([1, 1, 1])
|
497 |
+
with st.container():
|
498 |
+
with cols[0]:
|
499 |
+
LS1 = st.radio(
|
500 |
+
"1 - In most ways my life is close to my ideal.",
|
501 |
+
options=[
|
502 |
+
"Strongly Disagree",
|
503 |
+
"Disagree",
|
504 |
+
"Neutral",
|
505 |
+
"Agree",
|
506 |
+
"Strongly Agree",
|
507 |
+
],
|
508 |
+
)
|
509 |
+
with cols[1]:
|
510 |
+
LS2 = st.radio(
|
511 |
+
"2 - The conditions of my life are excellent.",
|
512 |
+
options=[
|
513 |
+
"Strongly Disagree",
|
514 |
+
"Disagree",
|
515 |
+
"Neutral",
|
516 |
+
"Agree",
|
517 |
+
"Strongly Agree",
|
518 |
+
],
|
519 |
+
)
|
520 |
+
|
521 |
+
with cols[2]:
|
522 |
+
LS3 = st.radio(
|
523 |
+
"3 - I am satisfied with my life.",
|
524 |
+
options=[
|
525 |
+
"Strongly Disagree",
|
526 |
+
"Disagree",
|
527 |
+
"Neutral",
|
528 |
+
"Agree",
|
529 |
+
"Strongly Agree",
|
530 |
+
],
|
531 |
+
)
|
532 |
+
cols = st.columns([1, 1, 1])
|
533 |
+
with st.container():
|
534 |
+
with cols[0]:
|
535 |
+
LS4 = st.radio(
|
536 |
+
"4 - So far I have gotten the important things I want in life.",
|
537 |
+
options=[
|
538 |
+
"Strongly Disagree",
|
539 |
+
"Disagree",
|
540 |
+
"Neutral",
|
541 |
+
"Agree",
|
542 |
+
"Strongly Agree",
|
543 |
+
],
|
544 |
+
)
|
545 |
+
with cols[1]:
|
546 |
+
LS5 = st.radio(
|
547 |
+
"5 - If I could live my life over I would change almost nothing.",
|
548 |
+
options=[
|
549 |
+
"Strongly Disagree",
|
550 |
+
"Disagree",
|
551 |
+
"Neutral",
|
552 |
+
"Agree",
|
553 |
+
"Strongly Agree",
|
554 |
+
],
|
555 |
+
)
|
556 |
+
run = st.button("Submit")
|
557 |
+
|
558 |
+
##Data gathering is completed for prediction##
|
559 |
+
|
560 |
+
# making dataframe of data given by user for prediction
|
561 |
+
|
562 |
+
df = pd.DataFrame(
|
563 |
+
{
|
564 |
+
"Age": [Age],
|
565 |
+
"Sex": [Sex],
|
566 |
+
"Location": [Location],
|
567 |
+
"SD1": [SD1],
|
568 |
+
"SD2": [SD2],
|
569 |
+
"D1": [D1],
|
570 |
+
"D2": [D2],
|
571 |
+
"V1": [V1],
|
572 |
+
"V2": [V2],
|
573 |
+
"SB1": [SB1],
|
574 |
+
"SB2": [SB2],
|
575 |
+
"BD1": [BD1],
|
576 |
+
"BD2": [BD2],
|
577 |
+
"A1": [A1],
|
578 |
+
"A2": [A2],
|
579 |
+
"AC1": [AC1],
|
580 |
+
"AC2": [AC2],
|
581 |
+
"S1": [S1],
|
582 |
+
"S2": [S2],
|
583 |
+
"S3": [S3],
|
584 |
+
"S4": [S4],
|
585 |
+
"S5": [S5],
|
586 |
+
"S6": [S6],
|
587 |
+
"S7": [S7],
|
588 |
+
"S8": [S8],
|
589 |
+
"S9": [S9],
|
590 |
+
"L1": [L1],
|
591 |
+
"L2": [L2],
|
592 |
+
"L3": [L3],
|
593 |
+
"L4": [L4],
|
594 |
+
"SE1": [SE1],
|
595 |
+
"SE2": [SE2],
|
596 |
+
"SE3": [SE3],
|
597 |
+
"SE4": [SE4],
|
598 |
+
"SE5": [SE5],
|
599 |
+
"LS1": [LS1],
|
600 |
+
"LS2": [LS2],
|
601 |
+
"LS3": [LS3],
|
602 |
+
"LS4": [LS4],
|
603 |
+
"LS5": [LS5],
|
604 |
+
}
|
605 |
+
)
|
606 |
+
|
607 |
+
# user data preprocessing
|
608 |
+
# Gender
|
609 |
+
def clean_gender(x):
|
610 |
+
if x == "Male":
|
611 |
+
return 1
|
612 |
+
elif x == "Female":
|
613 |
+
return 0
|
614 |
+
elif x == "There is no other gender. Itβs either him/her":
|
615 |
+
return 1
|
616 |
+
elif x == "Non binary":
|
617 |
+
return 0
|
618 |
+
return int(x)
|
619 |
+
|
620 |
+
df["Sex"] = df["Sex"].apply(clean_gender)
|
621 |
+
|
622 |
+
# Location
|
623 |
+
def clean_location(x):
|
624 |
+
if x == "Urban":
|
625 |
+
return 1
|
626 |
+
if x == "Rural":
|
627 |
+
return 0
|
628 |
+
return int(x)
|
629 |
+
|
630 |
+
df["Location"] = df["Location"].apply(clean_location)
|
631 |
+
|
632 |
+
# General_Psychopathology AND Shyness
|
633 |
+
def clean_General_Psychopathology(x):
|
634 |
+
if x == "Not at all":
|
635 |
+
return 1
|
636 |
+
elif x == "Slightly":
|
637 |
+
return 2
|
638 |
+
elif x == "Moderately":
|
639 |
+
return 3
|
640 |
+
elif x == "Very":
|
641 |
+
return 4
|
642 |
+
elif x == "Completely":
|
643 |
+
return 5
|
644 |
+
return int(x)
|
645 |
+
|
646 |
+
# General_Psychopathology AND Shyness
|
647 |
+
def clean_General_Psychopathology(x):
|
648 |
+
if x == "Not at all":
|
649 |
+
return 1
|
650 |
+
elif x == "Slightly":
|
651 |
+
return 2
|
652 |
+
elif x == "Moderately":
|
653 |
+
return 3
|
654 |
+
elif x == "Very":
|
655 |
+
return 4
|
656 |
+
elif x == "Completely":
|
657 |
+
return 5
|
658 |
+
return int(x)
|
659 |
+
|
660 |
+
df["S1"] = df["S1"].apply(clean_General_Psychopathology)
|
661 |
+
df["S2"] = df["S2"].apply(clean_General_Psychopathology)
|
662 |
+
df["S3"] = df["S3"].apply(clean_General_Psychopathology)
|
663 |
+
df["S4"] = df["S4"].apply(clean_General_Psychopathology)
|
664 |
+
df["S5"] = df["S5"].apply(clean_General_Psychopathology)
|
665 |
+
df["S6"] = df["S6"].apply(clean_General_Psychopathology)
|
666 |
+
df["S7"] = df["S7"].apply(clean_General_Psychopathology)
|
667 |
+
df["S8"] = df["S8"].apply(clean_General_Psychopathology)
|
668 |
+
df["S9"] = df["S9"].apply(clean_General_Psychopathology)
|
669 |
+
|
670 |
+
# Coping Strategies
|
671 |
+
def Coping_Strategies(x):
|
672 |
+
if x == "Never":
|
673 |
+
return 1
|
674 |
+
elif x == "Rarely":
|
675 |
+
return 2
|
676 |
+
elif x == "Sometimes":
|
677 |
+
return 3
|
678 |
+
elif x == "Often":
|
679 |
+
return 4
|
680 |
+
elif x == "Very Often":
|
681 |
+
return 5
|
682 |
+
return int(x)
|
683 |
+
|
684 |
+
df["SD1"] = df["SD1"].apply(Coping_Strategies)
|
685 |
+
df["SD2"] = df["SD2"].apply(Coping_Strategies)
|
686 |
+
|
687 |
+
df["D1"] = df["D1"].apply(Coping_Strategies)
|
688 |
+
df["D2"] = df["D2"].apply(Coping_Strategies)
|
689 |
+
|
690 |
+
df["V1"] = df["V1"].apply(Coping_Strategies)
|
691 |
+
df["V2"] = df["V2"].apply(Coping_Strategies)
|
692 |
+
|
693 |
+
df["SB1"] = df["SB1"].apply(Coping_Strategies)
|
694 |
+
df["SB2"] = df["SB2"].apply(Coping_Strategies)
|
695 |
+
|
696 |
+
df["BD1"] = df["BD1"].apply(Coping_Strategies)
|
697 |
+
df["BD2"] = df["BD2"].apply(Coping_Strategies)
|
698 |
+
|
699 |
+
df["A1"] = df["A1"].apply(Coping_Strategies)
|
700 |
+
df["A2"] = df["A2"].apply(Coping_Strategies)
|
701 |
+
|
702 |
+
df["AC1"] = df["AC1"].apply(Coping_Strategies)
|
703 |
+
df["AC2"] = df["AC2"].apply(Coping_Strategies)
|
704 |
+
|
705 |
+
# Loneliness & Self_Esteem & Life_Satisfaction
|
706 |
+
|
707 |
+
def Loneliness_Self_Esteem_Life_Satisfaction(x):
|
708 |
+
if x == "Strongly Disagree":
|
709 |
+
return 1
|
710 |
+
elif x == "Disagree":
|
711 |
+
return 2
|
712 |
+
elif x == "Neutral":
|
713 |
+
return 3
|
714 |
+
elif x == "Agree":
|
715 |
+
return 4
|
716 |
+
elif x == "Strongly Agree":
|
717 |
+
return 5
|
718 |
+
return int(x)
|
719 |
+
|
720 |
+
df["L1"] = df["L1"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
721 |
+
df["L2"] = df["L2"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
722 |
+
df["L3"] = df["L3"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
723 |
+
df["L4"] = df["L4"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
724 |
+
|
725 |
+
df["SE1"] = df["SE1"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
726 |
+
df["SE2"] = df["SE2"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
727 |
+
df["SE3"] = df["SE3"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
728 |
+
df["SE4"] = df["SE4"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
729 |
+
df["SE5"] = df["SE5"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
730 |
+
|
731 |
+
df["LS1"] = df["LS1"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
732 |
+
df["LS2"] = df["LS2"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
733 |
+
df["LS3"] = df["LS3"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
734 |
+
df["LS4"] = df["LS4"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
735 |
+
df["LS5"] = df["LS5"].apply(Loneliness_Self_Esteem_Life_Satisfaction)
|
736 |
+
|
737 |
+
# Rename the column afer taking mean within each section
|
738 |
+
|
739 |
+
df["Self_Distraction"] = df[["SD1", "SD2"]].mean(axis=1)
|
740 |
+
df["Denial"] = df[["D1", "D2"]].mean(axis=1)
|
741 |
+
df["Venting"] = df[["V1", "V2"]].mean(axis=1)
|
742 |
+
df["Self_Blame"] = df[["SB1", "SB2"]].mean(axis=1)
|
743 |
+
df["Behavioural_Disengagement"] = df[["BD1", "BD2"]].mean(axis=1)
|
744 |
+
df["Acceptance"] = df[["A1", "A2"]].mean(axis=1)
|
745 |
+
df["Active_Coping"] = df[["AC1", "AC2"]].mean(axis=1)
|
746 |
+
df["Shyness"] = df[["S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9"]].mean(
|
747 |
+
axis=1
|
748 |
+
)
|
749 |
+
df["Loneliness"] = df[["L1", "L2", "L3", "L4"]].mean(axis=1)
|
750 |
+
df["Self_Esteem"] = df[["SE1", "SE2", "SE3", "SE4", "SE5"]].mean(axis=1)
|
751 |
+
df["Life_Satisfaction"] = df[["LS1", "LS2", "LS3", "LS4", "LS5"]].mean(axis=1)
|
752 |
+
|
753 |
+
# Drop cloumns old columns after making new columns by using old clumns
|
754 |
+
df = df.drop(
|
755 |
+
[
|
756 |
+
"SD1",
|
757 |
+
"SD2",
|
758 |
+
"D1",
|
759 |
+
"D2",
|
760 |
+
"V1",
|
761 |
+
"V2",
|
762 |
+
"SB1",
|
763 |
+
"SB2",
|
764 |
+
"BD1",
|
765 |
+
"BD2",
|
766 |
+
"A1",
|
767 |
+
"A2",
|
768 |
+
"AC1",
|
769 |
+
"AC2",
|
770 |
+
"S1",
|
771 |
+
"S2",
|
772 |
+
"S3",
|
773 |
+
"S4",
|
774 |
+
"S5",
|
775 |
+
"S6",
|
776 |
+
"S7",
|
777 |
+
"S8",
|
778 |
+
"S9",
|
779 |
+
"L1",
|
780 |
+
"L2",
|
781 |
+
"L3",
|
782 |
+
"L4",
|
783 |
+
"SE1",
|
784 |
+
"SE2",
|
785 |
+
"SE3",
|
786 |
+
"SE4",
|
787 |
+
"SE5",
|
788 |
+
"LS1",
|
789 |
+
"LS2",
|
790 |
+
"LS3",
|
791 |
+
"LS4",
|
792 |
+
"LS5",
|
793 |
+
],
|
794 |
+
axis=1,
|
795 |
+
)
|
796 |
+
|
797 |
+
# prediction
|
798 |
+
# Age, Gender , General_Psychopathology ,Self_Distraction,Denial,Venting,Self_Blame,Behavioural_Disengagement,Acceptance,Active_Coping,Shyness,Loneliness,Self_Esteem,Life_Satisfaction
|
799 |
+
if run:
|
800 |
+
model = Load_mode()
|
801 |
+
|
802 |
+
X = np.array(
|
803 |
+
[
|
804 |
+
df["Age"],
|
805 |
+
df["Sex"],
|
806 |
+
df["Location"],
|
807 |
+
df["Self_Distraction"],
|
808 |
+
df["Denial"],
|
809 |
+
df["Venting"],
|
810 |
+
df["Self_Blame"],
|
811 |
+
df["Behavioural_Disengagement"],
|
812 |
+
df["Acceptance"],
|
813 |
+
df["Active_Coping"],
|
814 |
+
df["Shyness"],
|
815 |
+
df["Loneliness"],
|
816 |
+
df["Self_Esteem"],
|
817 |
+
df["Life_Satisfaction"],
|
818 |
+
]
|
819 |
+
).reshape(1, 14)
|
820 |
+
|
821 |
+
health = model.predict(X)
|
822 |
+
|
823 |
+
# Training set predictions converted to categories
|
824 |
+
|
825 |
+
if health >= 1 and health < 2:
|
826 |
+
health_2 = "Healthy"
|
827 |
+
elif health >= 2 and health <= 3.5:
|
828 |
+
health_2 = "Mild"
|
829 |
+
else:
|
830 |
+
health_2 = "Severe"
|
831 |
+
|
832 |
+
# st.markdown(f" Mental condition seems {health}.")
|
833 |
+
|
834 |
+
st.markdown(
|
835 |
+
'<div style=" color:black; font-size: 1.5rem; font-weight: 50; "> Results: </div>',
|
836 |
+
unsafe_allow_html=True,
|
837 |
+
)
|
838 |
+
|
839 |
+
if health_2 == "Healthy":
|
840 |
+
st.markdown(
|
841 |
+
'<div style=" padding-left: 40px; padding-right: 40px; padding-top: 20px; padding-bottom: 20px; color:black; font-size: 1.4rem;border-radius:1rem; font-weight: 50;background-color:rgba(61, 166, 198, 0.22) "> Hello! your answers indicate that you are doing great in your life. We are here to remind you to keep up the great work in maintaining and prioritizing your mental well-being. Whether you are enjoying your favorite activities or connecting with loved ones, keep making those positive choices and taking care of yourself. Wishing you continued wellness and happiness, cheers!</div>',
|
842 |
+
unsafe_allow_html=True,
|
843 |
+
)
|
844 |
+
|
845 |
+
elif health_2 == "Mild":
|
846 |
+
st.markdown(
|
847 |
+
'<div style=" padding-left: 40px; padding-right: 40px;padding-top: 20px; padding-bottom: 20px; color:black; font-size: 1.4rem;border-radius:1rem; font-weight: 50;background-color:rgba(61, 166, 198, 0.22) "> Hello there, based on your answers you seem to do well but we observe that you are struggling to keep up with it. It is completely normal to face challenges. We recommend considering a chat with friends, family, or a mental health professional for additional support. Remember, taking steps for your mental well-being is a positive choice. </div>',
|
848 |
+
unsafe_allow_html=True,
|
849 |
+
)
|
850 |
+
elif health_2 == "Severe":
|
851 |
+
st.markdown(
|
852 |
+
'<div style=" padding-left: 40px; padding-right: 40px;padding-top: 20px; padding-bottom: 20px; color:black; font-size: 1.4rem;border-radius:1rem; font-weight: 50;background-color:rgba(61, 166, 198, 0.22) ">Hey there, looks like you might be going through a tough time, consider talking to a mental health professional or someone you trust. They can provide support and guidance. Remember, it is okay to seek help. Take care.</div>',
|
853 |
+
unsafe_allow_html=True,
|
854 |
+
)
|
855 |
+
return health_2
|
856 |
+
|
857 |
+
|
858 |
+
if __name__ == "__main__":
|
859 |
+
Prediction()
|
README.md
CHANGED
@@ -1,10 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: pink
|
6 |
-
sdk: docker
|
7 |
-
pinned: false
|
8 |
-
---
|
9 |
-
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
• Here , we developed a web app for visitors. So, they know their Mental Health Staus. <br>
|
2 |
+
• We took survey on google form and pre-processed data. We tried differnt ML models, <br> but ANN Regressor **(With 73% test accuracy)** perform decent and better from all different models which we tried.<br>
|
3 |
+
• Interested to know your mental health status !!! π https://mentalhealthprediction.onrender.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Report-pana.png
ADDED
Schizophrenia-pana.png
ADDED
Standup meeting-pana.png
ADDED
app.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from st_pages import Page, show_pages
|
3 |
+
|
4 |
+
# import base64
|
5 |
+
|
6 |
+
# should be
|
7 |
+
|
8 |
+
st.set_page_config(
|
9 |
+
page_title="Mental Health Prediction",
|
10 |
+
page_icon="π",
|
11 |
+
layout="wide",
|
12 |
+
initial_sidebar_state="expanded",
|
13 |
+
)
|
14 |
+
|
15 |
+
# bottom code is for injecting image in side bar
|
16 |
+
|
17 |
+
# @st.cache_data
|
18 |
+
# def get_img_as_base64(file):
|
19 |
+
# with open(file, "rb") as f:
|
20 |
+
# data = f.read()
|
21 |
+
# return base64.b64encode(data).decode()
|
22 |
+
|
23 |
+
|
24 |
+
# image = get_img_as_base64("brain2.png")
|
25 |
+
|
26 |
+
|
27 |
+
page_bg_img_link = f"""
|
28 |
+
<style>
|
29 |
+
[data-testid="stAppViewContainer"]> .main{{
|
30 |
+
|
31 |
+
# background-image: url(https://www.orfonline.org/wp-content/uploads/2022/10/mental-health-wellness-during-covid-19.jpg);
|
32 |
+
# background-size:cover;
|
33 |
+
# background-position: left;
|
34 |
+
# background-repeat:no-repeat;
|
35 |
+
# background-attachment:local;
|
36 |
+
background-color: #FFDEE9;
|
37 |
+
background-image: linear-gradient(0deg, #FFDEE9 0%, #B5FFFC 100%);
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
}}
|
43 |
+
|
44 |
+
|
45 |
+
[data-testid="stHeader"]{{
|
46 |
+
background-color: rgba(0,0,0,0)
|
47 |
+
|
48 |
+
}}
|
49 |
+
|
50 |
+
[data-testid="stToolbar"]{{
|
51 |
+
right : 2 rem;
|
52 |
+
}}
|
53 |
+
|
54 |
+
[data-testid="stSidebar"] > div:first-child{{
|
55 |
+
|
56 |
+
|
57 |
+
background: linear-gradient(to right bottom,
|
58 |
+
rgba(255,225,225,0.7),
|
59 |
+
rgba(255,225,225,0.3));
|
60 |
+
}}
|
61 |
+
|
62 |
+
|
63 |
+
</style>
|
64 |
+
"""
|
65 |
+
st.markdown(page_bg_img_link, unsafe_allow_html=True)
|
66 |
+
|
67 |
+
with st.sidebar:
|
68 |
+
# st.markdown(
|
69 |
+
# '<div style=" font-family: Mali, cursive;text-align: center; font-size:30px; color:#ff725e; margin :10px">Mental Health</div>',
|
70 |
+
# unsafe_allow_html=True,
|
71 |
+
# )
|
72 |
+
|
73 |
+
st.image(
|
74 |
+
"Mental health-pana.png",
|
75 |
+
width=320,
|
76 |
+
)
|
77 |
+
show_pages(
|
78 |
+
[
|
79 |
+
Page(r"app.py", "Home", "π "),
|
80 |
+
Page(r"Pages/Prediction.py", "Have your Psychopathology test!", "π₯"),
|
81 |
+
Page(r"Pages/About.py", "About Us", "π¦Ύ"),
|
82 |
+
]
|
83 |
+
)
|
84 |
+
|
85 |
+
|
86 |
+
# Display the main page of the app with instructions on how to use it
|
87 |
+
def main():
|
88 |
+
# title
|
89 |
+
st.markdown(
|
90 |
+
'<div style=" font-family: Mali, cursive;text-align: center; font-size:3.5rem; color: rgb(69, 90, 100); margin-bottom :20px">Mental Health Status</div>',
|
91 |
+
unsafe_allow_html=True,
|
92 |
+
)
|
93 |
+
st.markdown(
|
94 |
+
'<div style=" font-family: Mali, cursive; font-size:20px; color:black;">Mental health includes our emotional, psychological, and social well-being. It affects how we think, feel, and act. It also helps determine how we handle stress, relate to others, and make choices. Mental health is important at every stage of life, from childhood and adolescence through adulthood.</div>',
|
95 |
+
unsafe_allow_html=True,
|
96 |
+
)
|
97 |
+
st.markdown("""""")
|
98 |
+
st.markdown(
|
99 |
+
'<div style=" font-family: Mali, cursive; font-size:20px; color:black;">Over the course of your life, if you experience mental health problems, your thinking, mood, and behavior could be affected. Many factors contribute to mental health problems, we aim to find those factors.</div>',
|
100 |
+
unsafe_allow_html=True,
|
101 |
+
)
|
102 |
+
st.markdown("""""")
|
103 |
+
st.markdown("""""")
|
104 |
+
st.markdown("""""")
|
105 |
+
|
106 |
+
cols = st.columns([1, 1])
|
107 |
+
with st.container():
|
108 |
+
with cols[0]:
|
109 |
+
st.markdown(
|
110 |
+
'<div style=" font-family: Mali, cursive; font-size:30px; color:black;">How to use this app:</div>',
|
111 |
+
unsafe_allow_html=True,
|
112 |
+
)
|
113 |
+
st.markdown("""""")
|
114 |
+
st.markdown("""""")
|
115 |
+
|
116 |
+
st.markdown(
|
117 |
+
'<div style=" font-family: Mali, cursive; font-size:25px; color:black;">π To know your Psychopathology condition!</div>',
|
118 |
+
unsafe_allow_html=True,
|
119 |
+
)
|
120 |
+
st.markdown("""""")
|
121 |
+
st.markdown("""""")
|
122 |
+
st.markdown("""""")
|
123 |
+
st.markdown(
|
124 |
+
'<div style=" font-family: Mali, cursive; color:black; font-size:18px;">1. Select the Psychopathology Test from the sidebar.</div>',
|
125 |
+
unsafe_allow_html=True,
|
126 |
+
)
|
127 |
+
st.markdown("""""")
|
128 |
+
st.markdown(
|
129 |
+
'<div style=" font-family: Mali, cursive; font-size:18px; color:black;">2. Fill and choose all asked question after reading .</div>',
|
130 |
+
unsafe_allow_html=True,
|
131 |
+
)
|
132 |
+
st.markdown("""""")
|
133 |
+
st.markdown(
|
134 |
+
'<div style=" font-family: Mali, cursive; font-size:18px; color:black;">3. Attempt all questions of five section and then click on predict button.</div>',
|
135 |
+
unsafe_allow_html=True,
|
136 |
+
)
|
137 |
+
st.markdown("""""")
|
138 |
+
|
139 |
+
with cols[1]:
|
140 |
+
st.image(
|
141 |
+
"Schizophrenia-pana.png",
|
142 |
+
width=550,
|
143 |
+
)
|
144 |
+
|
145 |
+
|
146 |
+
if __name__ == "__main__":
|
147 |
+
main()
|
requirements.txt
ADDED
Binary file (2.95 kB). View file
|
|
train.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:986c04e407864024c1ad857a5627ae309a2b67a084566672e92af5f549b23932
|
3 |
+
size 57776
|
train.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8a9ed9245cbb6708074ddc37da2f6c60b2b89ff98096948fa77c66e54cf47966
|
3 |
+
size 51297
|