Spaces:
Sleeping
Sleeping
Update homepage.py
Browse files- homepage.py +82 -82
homepage.py
CHANGED
@@ -1,83 +1,83 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from PIL import Image
|
3 |
-
import base64
|
4 |
-
from io import BytesIO
|
5 |
-
|
6 |
-
def image_to_base64(img):
|
7 |
-
buffered = BytesIO()
|
8 |
-
img.save(buffered, format="PNG")
|
9 |
-
return base64.b64encode(buffered.getvalue()).decode()
|
10 |
-
|
11 |
-
def display_homepage():
|
12 |
-
image = Image.open('image.jpg')
|
13 |
-
img_base64 = image_to_base64(image)
|
14 |
-
|
15 |
-
st.markdown(
|
16 |
-
f"""
|
17 |
-
<style>
|
18 |
-
/* Set background color to white for both light and dark mode */
|
19 |
-
body {{
|
20 |
-
background-color: #ffffff ;
|
21 |
-
}}
|
22 |
-
|
23 |
-
.image-container {{
|
24 |
-
position: relative;
|
25 |
-
margin-top: -
|
26 |
-
margin-left: auto;
|
27 |
-
margin-right: auto;
|
28 |
-
width: 300px; /* Increase width for larger image */
|
29 |
-
display: flex;
|
30 |
-
justify-content: center;
|
31 |
-
}}
|
32 |
-
.content-container {{
|
33 |
-
margin-top: 50px; /* Adjust margin-top to make space for the image */
|
34 |
-
}}
|
35 |
-
.main {{
|
36 |
-
background-color: #ffffff ;
|
37 |
-
}}
|
38 |
-
|
39 |
-
/* Text and button styling */
|
40 |
-
.stButton>button {{
|
41 |
-
background-color: #2980b9;
|
42 |
-
color: white;
|
43 |
-
font-size: 18px;
|
44 |
-
font-weight: bold;
|
45 |
-
padding: 15px 30px;
|
46 |
-
border-radius: 8px;
|
47 |
-
border: none;
|
48 |
-
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.1);
|
49 |
-
cursor: pointer;
|
50 |
-
transition: background-color 0.3s ease;
|
51 |
-
}}
|
52 |
-
.stButton>button:hover {{
|
53 |
-
background-color: #3498db;
|
54 |
-
}}
|
55 |
-
</style>
|
56 |
-
<div class="image-container">
|
57 |
-
<img src="data:image/png;base64,{img_base64}" alt="image"/>
|
58 |
-
</div>
|
59 |
-
""",
|
60 |
-
unsafe_allow_html=True
|
61 |
-
)
|
62 |
-
|
63 |
-
st.markdown(
|
64 |
-
"""
|
65 |
-
<div class="content-container">
|
66 |
-
<div style="text-align: center; font-size: 60px; font-weight: bold; color: #
|
67 |
-
AI Support for Your Mental Well-Being
|
68 |
-
</div>
|
69 |
-
<div style="text-align: center; font-size: 20px; margin-top: 20px; max-width: 700px; margin-left: auto; margin-right: auto;">
|
70 |
-
Designed to streamline your mental health journey, our AI therapist is here to offer round-the-clock support, addressing mental health-related queries, providing personalized reports, and helping you understand your stress level to ensure a smoother journey toward mental and emotional health.
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
""", unsafe_allow_html=True
|
74 |
-
)
|
75 |
-
|
76 |
-
col1, col2 = st.columns([1, 1])
|
77 |
-
with col1:
|
78 |
-
if st.button("Start Chat", key="start_chat_button"):
|
79 |
-
st.session_state.page = "chat"
|
80 |
-
|
81 |
-
with col2:
|
82 |
-
if st.button("Stress Test", key="predict_stress_button"):
|
83 |
st.session_state.page = "stress"
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
import base64
|
4 |
+
from io import BytesIO
|
5 |
+
|
6 |
+
def image_to_base64(img):
|
7 |
+
buffered = BytesIO()
|
8 |
+
img.save(buffered, format="PNG")
|
9 |
+
return base64.b64encode(buffered.getvalue()).decode()
|
10 |
+
|
11 |
+
def display_homepage():
|
12 |
+
image = Image.open('image.jpg')
|
13 |
+
img_base64 = image_to_base64(image)
|
14 |
+
|
15 |
+
st.markdown(
|
16 |
+
f"""
|
17 |
+
<style>
|
18 |
+
/* Set background color to white for both light and dark mode */
|
19 |
+
body {{
|
20 |
+
background-color: #ffffff ;
|
21 |
+
}}
|
22 |
+
|
23 |
+
.image-container {{
|
24 |
+
position: relative;
|
25 |
+
margin-top: -50px;
|
26 |
+
margin-left: auto;
|
27 |
+
margin-right: auto;
|
28 |
+
width: 300px; /* Increase width for larger image */
|
29 |
+
display: flex;
|
30 |
+
justify-content: center;
|
31 |
+
}}
|
32 |
+
.content-container {{
|
33 |
+
margin-top: 50px; /* Adjust margin-top to make space for the image */
|
34 |
+
}}
|
35 |
+
.main {{
|
36 |
+
background-color: #ffffff ;
|
37 |
+
}}
|
38 |
+
|
39 |
+
/* Text and button styling */
|
40 |
+
.stButton>button {{
|
41 |
+
background-color: #2980b9;
|
42 |
+
color: white;
|
43 |
+
font-size: 18px;
|
44 |
+
font-weight: bold;
|
45 |
+
padding: 15px 30px;
|
46 |
+
border-radius: 8px;
|
47 |
+
border: none;
|
48 |
+
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.1);
|
49 |
+
cursor: pointer;
|
50 |
+
transition: background-color 0.3s ease;
|
51 |
+
}}
|
52 |
+
.stButton>button:hover {{
|
53 |
+
background-color: #3498db;
|
54 |
+
}}
|
55 |
+
</style>
|
56 |
+
<div class="image-container">
|
57 |
+
<img src="data:image/png;base64,{img_base64}" alt="image"/>
|
58 |
+
</div>
|
59 |
+
""",
|
60 |
+
unsafe_allow_html=True
|
61 |
+
)
|
62 |
+
|
63 |
+
st.markdown(
|
64 |
+
"""
|
65 |
+
<div class="content-container">
|
66 |
+
<div style="text-align: center; font-size: 60px; font-weight: bold; color: #97c0c2;">
|
67 |
+
AI Support for Your Mental Well-Being
|
68 |
+
</div>
|
69 |
+
<div style="text-align: center; font-size: 20px; margin-top: 20px; max-width: 700px; margin-left: auto; margin-right: auto;">
|
70 |
+
Designed to streamline your mental health journey, our AI therapist is here to offer round-the-clock support, addressing mental health-related queries, providing personalized reports, and helping you understand your stress level to ensure a smoother journey toward mental and emotional health.
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
""", unsafe_allow_html=True
|
74 |
+
)
|
75 |
+
|
76 |
+
col1, col2 = st.columns([1, 1])
|
77 |
+
with col1:
|
78 |
+
if st.button("Start Chat", key="start_chat_button"):
|
79 |
+
st.session_state.page = "chat"
|
80 |
+
|
81 |
+
with col2:
|
82 |
+
if st.button("Stress Test", key="predict_stress_button"):
|
83 |
st.session_state.page = "stress"
|