Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,6 +36,396 @@ if "transcribed_text" not in st.session_state:
|
|
| 36 |
ADMIN_USERNAME = os.getenv("ADMIN_USERNAME") # Set in HF Spaces secrets
|
| 37 |
ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD") # Set in HF Spaces secrets
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
# User management functions
|
| 40 |
def hash_password(password):
|
| 41 |
"""Hash password using SHA-256 with salt"""
|
|
@@ -125,245 +515,117 @@ def detect_emotion(text):
|
|
| 125 |
prediction = emotion_pipeline(text)[0][0]
|
| 126 |
return prediction['label'].lower(), prediction['score']
|
| 127 |
|
|
|
|
| 128 |
# Authentication UI
|
| 129 |
def show_auth_page():
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
/* Main Container for Auth Form (makes it look like a card) */
|
| 143 |
-
.stApp > header { /* Hide Streamlit's default header */
|
| 144 |
-
display: none;
|
| 145 |
-
}
|
| 146 |
-
.main .block-container {
|
| 147 |
-
max-width: 500px; /* Limit width for better aesthetics */
|
| 148 |
-
margin: auto; /* Center the container */
|
| 149 |
-
padding: 3rem 2.5rem; /* Increased padding top/bottom and sides */
|
| 150 |
-
background-color: #ffffff; /* White background for the form card */
|
| 151 |
-
border-radius: 20px; /* Even softer rounded corners */
|
| 152 |
-
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15); /* Deeper, softer shadow for card effect */
|
| 153 |
-
text-align: center; /* Center content within the card */
|
| 154 |
-
animation: fadeIn 0.8s ease-out; /* Add a subtle fade-in animation */
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
/* Keyframe for fade-in animation */
|
| 158 |
-
@keyframes fadeIn {
|
| 159 |
-
from { opacity: 0; transform: translateY(20px); }
|
| 160 |
-
to { opacity: 1; transform: translateY(0); }
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
/* Titles and Subheaders */
|
| 165 |
-
h1 {
|
| 166 |
-
color: #7289da; /* DilBot's primary color */
|
| 167 |
-
font-size: 3em; /* Larger title */
|
| 168 |
-
font-weight: 800; /* Bolder */
|
| 169 |
-
margin-bottom: 0.2rem; /* Less space to tagline */
|
| 170 |
-
letter-spacing: -0.5px; /* Slight letter spacing for visual appeal */
|
| 171 |
-
}
|
| 172 |
-
.tagline { /* Custom class for the tagline */
|
| 173 |
-
color: #6a7c96; /* Softer blue-grey for the tagline */
|
| 174 |
-
font-size: 1.2em;
|
| 175 |
-
margin-top: 0; /* Align closely with title */
|
| 176 |
-
margin-bottom: 2.5rem; /* More space to tabs */
|
| 177 |
-
font-weight: 500;
|
| 178 |
-
}
|
| 179 |
-
h2 { /* Subheaders for Login/Sign Up tabs */
|
| 180 |
-
color: #4A4A4A;
|
| 181 |
-
font-size: 1.8em; /* Slightly larger */
|
| 182 |
-
font-weight: 700; /* Bolder */
|
| 183 |
-
margin-top: 1.5rem;
|
| 184 |
-
margin-bottom: 1.8rem; /* More space below subheader */
|
| 185 |
-
text-align: center;
|
| 186 |
-
}
|
| 187 |
|
| 188 |
-
|
| 189 |
-
.stTabs [data-baseweb="tab-list"] {
|
| 190 |
-
justify-content: center; /* Center the tabs themselves */
|
| 191 |
-
gap: 25px; /* More space between tabs */
|
| 192 |
-
margin-bottom: 2.5rem; /* More space below tabs */
|
| 193 |
-
}
|
| 194 |
-
.stTabs [data-baseweb="tab-list"] button {
|
| 195 |
-
background-color: transparent;
|
| 196 |
-
border: none;
|
| 197 |
-
padding: 12px 25px; /* Increased padding for tabs */
|
| 198 |
-
font-size: 1.3em; /* Larger tab text */
|
| 199 |
-
font-weight: 700; /* Bolder */
|
| 200 |
-
color: #a0a0a0; /* Lighter grey for inactive tabs */
|
| 201 |
-
border-bottom: 4px solid transparent; /* Thicker underline */
|
| 202 |
-
transition: color 0.3s, border-bottom 0.3s;
|
| 203 |
-
}
|
| 204 |
-
.stTabs [data-baseweb="tab-list"] button:hover {
|
| 205 |
-
color: #7289da;
|
| 206 |
-
border-bottom: 4px solid #b0c4de; /* Lighter blue on hover */
|
| 207 |
-
}
|
| 208 |
-
.stTabs [data-baseweb="tab-list"] button[aria-selected="true"] {
|
| 209 |
-
color: #7289da; /* DilBot's primary color for active tab */
|
| 210 |
-
border-bottom: 4px solid #7289da; /* Stronger accent for active tab */
|
| 211 |
-
}
|
| 212 |
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
font-
|
| 216 |
-
color: #
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
}
|
| 222 |
-
.stTextInput>div>div>input {
|
| 223 |
-
border-radius: 12px; /* Even more rounded */
|
| 224 |
-
border: 1px solid #e0e0e0; /* Softer border */
|
| 225 |
-
padding: 14px 18px; /* Even more padding */
|
| 226 |
-
font-size: 1.1em; /* Slightly larger font in input */
|
| 227 |
-
color: #333333;
|
| 228 |
-
background-color: #fcfcfc; /* Slightly off-white background */
|
| 229 |
-
box-shadow: inset 0 2px 5px rgba(0,0,0,0.03); /* More subtle inner shadow */
|
| 230 |
-
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
| 231 |
-
}
|
| 232 |
-
.stTextInput>div>div>input:focus {
|
| 233 |
-
border-color: #7289da; /* Highlight on focus */
|
| 234 |
-
box-shadow: 0 0 0 0.25rem rgba(114, 137, 218, 0.3); /* Stronger glow effect on focus */
|
| 235 |
-
outline: none;
|
| 236 |
-
}
|
| 237 |
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
.
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
transform: translateY(0);
|
| 262 |
-
box-shadow: 0 5px 15px rgba(0,0,0,0.15);
|
| 263 |
-
}
|
| 264 |
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
box-shadow: 0 2px 10px rgba(0,0,0,0.05); /* Subtle shadow for alerts */
|
| 274 |
-
}
|
| 275 |
-
/* Specific styles for each type with slightly richer colors */
|
| 276 |
-
[data-testid="stAlert"] .streamlit-warning {
|
| 277 |
-
background-color: #fef7e0; color: #7a5f00; border-left: 6px solid #ffcc00;
|
| 278 |
-
}
|
| 279 |
-
[data-testid="stAlert"] .streamlit-success {
|
| 280 |
-
background-color: #e6ffe6; color: #0a6b0a; border-left: 6px solid #4CAF50;
|
| 281 |
-
}
|
| 282 |
-
[data-testid="stAlert"] .streamlit-error {
|
| 283 |
-
background-color: #ffe6e6; color: #8c0a0a; border-left: 6px solid #e74c3c;
|
| 284 |
-
}
|
| 285 |
-
[data-testid="stAlert"] .streamlit-info {
|
| 286 |
-
background-color: #e6f7ff; color: #0a4d6e; border-left: 6px solid #3498db;
|
| 287 |
-
}
|
| 288 |
|
| 289 |
-
|
| 290 |
-
.
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
}
|
| 298 |
|
| 299 |
-
|
| 300 |
-
.
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
|
|
|
| 304 |
""", unsafe_allow_html=True)
|
| 305 |
-
# --- END FURTHER ENHANCED CUSTOM CSS ---
|
| 306 |
|
| 307 |
-
|
| 308 |
-
#
|
| 309 |
-
st.title("DilBot") # Just the name
|
| 310 |
-
st.markdown("<p class='tagline'>Your Intelligent Emotional Companion</p>", unsafe_allow_html=True) # Tagline as subtitle
|
| 311 |
|
| 312 |
-
st.markdown("---") # Visual separator
|
| 313 |
|
| 314 |
-
|
| 315 |
|
|
|
|
|
|
|
| 316 |
with tab1:
|
| 317 |
st.subheader("Login to Your Account")
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
st.
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
login_password = st.text_input("Password", type="password", key="login_pass", placeholder="Enter your password",
|
| 325 |
-
label_visibility="collapsed")
|
| 326 |
-
st.markdown("<p style='text-align: left; color: #555555; font-weight: 600; margin-bottom: 0.6rem; padding-left: 5px;'>Password</p>", unsafe_allow_html=True)
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
if st.button("Login", key="login_btn", use_container_width=True):
|
| 330 |
if login_username and login_password:
|
| 331 |
success, message, is_admin = login(login_username, login_password)
|
| 332 |
if success:
|
| 333 |
st.session_state.authenticated = True
|
| 334 |
st.session_state.username = login_username
|
| 335 |
st.session_state.is_admin = is_admin
|
| 336 |
-
st.
|
| 337 |
st.rerun()
|
| 338 |
else:
|
| 339 |
st.error(message)
|
| 340 |
else:
|
| 341 |
st.warning("Please fill in all fields")
|
| 342 |
-
|
| 343 |
with tab2:
|
| 344 |
st.subheader("Create New Account")
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
st.
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
signup_email = st.text_input("Email Address", key="signup_email", placeholder="Enter your email address",
|
| 352 |
-
label_visibility="collapsed")
|
| 353 |
-
st.markdown("<p style='text-align: left; color: #555555; font-weight: 600; margin-bottom: 0.6rem; padding-left: 5px;'>Email Address</p>", unsafe_allow_html=True)
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
signup_password = st.text_input("Choose Password", type="password", key="signup_pass", placeholder="At least 6 characters",
|
| 357 |
-
label_visibility="collapsed")
|
| 358 |
-
st.markdown("<p style='text-align: left; color: #555555; font-weight: 600; margin-bottom: 0.6rem; padding-left: 5px;'>Choose Password</p>", unsafe_allow_html=True)
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
signup_confirm = st.text_input("Confirm Password", type="password", key="signup_confirm", placeholder="Re-enter your password",
|
| 362 |
-
label_visibility="collapsed")
|
| 363 |
-
st.markdown("<p style='text-align: left; color: #555555; font-weight: 600; margin-bottom: 0.6rem; padding-left: 5px;'>Confirm Password</p>", unsafe_allow_html=True)
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
if st.button("Create Account", key="signup_btn", use_container_width=True):
|
| 367 |
if all([signup_username, signup_email, signup_password, signup_confirm]):
|
| 368 |
if signup_password != signup_confirm:
|
| 369 |
st.error("Passwords don't match!")
|
|
@@ -379,7 +641,8 @@ def show_auth_page():
|
|
| 379 |
else:
|
| 380 |
st.warning("Please fill in all fields")
|
| 381 |
|
| 382 |
-
st.markdown("
|
|
|
|
| 383 |
# Main app functions
|
| 384 |
def build_user_vectorstore(username, quotes):
|
| 385 |
"""Build and save user-specific vectorstore"""
|
|
|
|
| 36 |
ADMIN_USERNAME = os.getenv("ADMIN_USERNAME") # Set in HF Spaces secrets
|
| 37 |
ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD") # Set in HF Spaces secrets
|
| 38 |
|
| 39 |
+
# --- UI/UX Modifications (Applied globally) ---
|
| 40 |
+
def set_background_and_styles():
|
| 41 |
+
st.markdown(
|
| 42 |
+
"""
|
| 43 |
+
<style>
|
| 44 |
+
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;700&display=swap');
|
| 45 |
+
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700&display=swap');
|
| 46 |
+
.stApp {
|
| 47 |
+
background: linear-gradient(135deg, #e0e7ff 0%, #c6e2ff 50%, #b0c4de 100%); /* Light blueish gradient */
|
| 48 |
+
background-size: cover;
|
| 49 |
+
background-position: center;
|
| 50 |
+
background-repeat: no-repeat;
|
| 51 |
+
background-attachment: fixed;
|
| 52 |
+
font-family: 'Montserrat', sans-serif;
|
| 53 |
+
color: #333; /* Default text color to dark for light background */
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
h1, h2, h3, h4, h5, h6, .stMarkdown, label {
|
| 57 |
+
font-family: 'Merriweather', serif;
|
| 58 |
+
color: #1a237e; /* Darker blue for headings */
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/* Ensure text area label is dark */
|
| 62 |
+
.stTextArea > label {
|
| 63 |
+
color: #333 !important;
|
| 64 |
+
}
|
| 65 |
+
.stButton>button {
|
| 66 |
+
background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%); /* Blue-purple gradient */
|
| 67 |
+
color: white;
|
| 68 |
+
border-radius: 8px;
|
| 69 |
+
border: none;
|
| 70 |
+
padding: 10px 20px;
|
| 71 |
+
font-size: 16px;
|
| 72 |
+
font-weight: bold;
|
| 73 |
+
transition: all 0.2s ease-in-out;
|
| 74 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 75 |
+
}
|
| 76 |
+
.stButton>button:hover {
|
| 77 |
+
transform: translateY(-2px);
|
| 78 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/* Secondary button style for "Explore Opportunities" */
|
| 82 |
+
.secondary-button > button {
|
| 83 |
+
background-color: white;
|
| 84 |
+
color: #6a11cb;
|
| 85 |
+
border: 1px solid #6a11cb;
|
| 86 |
+
box-shadow: none;
|
| 87 |
+
}
|
| 88 |
+
.secondary-button > button:hover {
|
| 89 |
+
background-color: #f0f4f8; /* Light hover */
|
| 90 |
+
color: #2575fc;
|
| 91 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 92 |
+
}
|
| 93 |
+
.stTextInput>div>div>input, .stTextArea>div>div>textarea, .stSelectbox>div>div>div {
|
| 94 |
+
border-radius: 8px;
|
| 95 |
+
border: 1px solid #b3e5fc; /* Light blue border */
|
| 96 |
+
padding: 10px;
|
| 97 |
+
background-color: rgba(255, 255, 255, 0.95); /* Nearly opaque white */
|
| 98 |
+
color: #333; /* Input text color dark */
|
| 99 |
+
}
|
| 100 |
+
/* Adjusted stSuccess and stInfo for white text on darker transparent black background */
|
| 101 |
+
.stSuccess {
|
| 102 |
+
border-left: 5px solid #28a745;
|
| 103 |
+
background-color: rgba(0, 0, 0, 0.6); /* Transparent black */
|
| 104 |
+
color: white; /* Make text white */
|
| 105 |
+
border-radius: 8px;
|
| 106 |
+
padding: 10px;
|
| 107 |
+
margin-bottom: 10px;
|
| 108 |
+
}
|
| 109 |
+
.stInfo {
|
| 110 |
+
border-left: 5px solid #17a2b8;
|
| 111 |
+
background-color: rgba(0, 0, 0, 0.6); /* Transparent black */
|
| 112 |
+
color: white; /* Make text white */
|
| 113 |
+
border-radius: 8px;
|
| 114 |
+
padding: 10px;
|
| 115 |
+
margin-bottom: 10px;
|
| 116 |
+
}
|
| 117 |
+
/* Keeping warning/error as original light background for now, as black transparent might not suit warnings well */
|
| 118 |
+
.stWarning {
|
| 119 |
+
border-left: 5px solid #ffc107;
|
| 120 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 121 |
+
color: #333;
|
| 122 |
+
border-radius: 8px;
|
| 123 |
+
padding: 10px;
|
| 124 |
+
margin-bottom: 10px;
|
| 125 |
+
}
|
| 126 |
+
.stError {
|
| 127 |
+
border-left: 5px solid #dc3545;
|
| 128 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 129 |
+
color: #333;
|
| 130 |
+
border-radius: 8px;
|
| 131 |
+
padding: 10px;
|
| 132 |
+
margin-bottom: 10px;
|
| 133 |
+
}
|
| 134 |
+
/* Custom container for content with blur background - used for auth form */
|
| 135 |
+
.auth-content-container {
|
| 136 |
+
background-color: rgba(255, 255, 255, 0.8); /* Slightly transparent white */
|
| 137 |
+
backdrop-filter: blur(8px); /* Blur effect */
|
| 138 |
+
border-radius: 15px;
|
| 139 |
+
padding: 30px;
|
| 140 |
+
margin: 20px auto;
|
| 141 |
+
max-width: 450px; /* Slimmer for auth forms */
|
| 142 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
| 143 |
+
text-align: center; /* Center content within */
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.feature-grid {
|
| 147 |
+
display: grid;
|
| 148 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Adjusted for more flexibility */
|
| 149 |
+
gap: 20px;
|
| 150 |
+
margin-top: 30px;
|
| 151 |
+
margin-bottom: 30px;
|
| 152 |
+
max-width: 900px; /* Max width for the grid itself */
|
| 153 |
+
margin-left: auto;
|
| 154 |
+
margin-right: auto;
|
| 155 |
+
}
|
| 156 |
+
.feature-item {
|
| 157 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 158 |
+
border-radius: 12px;
|
| 159 |
+
padding: 20px;
|
| 160 |
+
text-align: center;
|
| 161 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
|
| 162 |
+
transition: transform 0.2s ease-in-out;
|
| 163 |
+
border: 1px solid #e0e0e0;
|
| 164 |
+
}
|
| 165 |
+
.feature-item:hover {
|
| 166 |
+
transform: translateY(-5px);
|
| 167 |
+
box-shadow: 0 8px 15px rgba(0, 0, 0, 0.12);
|
| 168 |
+
}
|
| 169 |
+
.feature-item .icon-img {
|
| 170 |
+
height: 60px; /* Adjust icon size as needed */
|
| 171 |
+
margin-bottom: 10px;
|
| 172 |
+
display: block; /* Ensure icon is on its own line */
|
| 173 |
+
margin-left: auto;
|
| 174 |
+
margin-right: auto;
|
| 175 |
+
}
|
| 176 |
+
.feature-item h3 {
|
| 177 |
+
font-size: 1.2em;
|
| 178 |
+
color: #1a237e;
|
| 179 |
+
margin-bottom: 8px;
|
| 180 |
+
}
|
| 181 |
+
.feature-item p {
|
| 182 |
+
font-size: 0.9em;
|
| 183 |
+
color: #555;
|
| 184 |
+
line-height: 1.5;
|
| 185 |
+
}
|
| 186 |
+
/* Main app content container */
|
| 187 |
+
.main-app-content-container {
|
| 188 |
+
background-color: rgba(255, 255, 255, 0.8); /* Slightly transparent white */
|
| 189 |
+
backdrop-filter: blur(8px); /* Blur effect */
|
| 190 |
+
border-radius: 15px;
|
| 191 |
+
padding: 30px;
|
| 192 |
+
margin: 20px auto;
|
| 193 |
+
max-width: 800px; /* Wider for main app content */
|
| 194 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
| 195 |
+
color: #333; /* Dark text inside */
|
| 196 |
+
}
|
| 197 |
+
/* Ensure headers within main app container are dark */
|
| 198 |
+
.main-app-content-container h1, .main-app-content-container h2,
|
| 199 |
+
.main-app-content-container h3, .main-app-content-container h4,
|
| 200 |
+
.main-app-content-container h5, .main-app-content-container h6,
|
| 201 |
+
.main-app-content-container .stMarkdown, .main-app-content-container label {
|
| 202 |
+
color: #1a237e; /* Darker blue for headers in main app */
|
| 203 |
+
}
|
| 204 |
+
/* Specifically target text within main-app-content-container to be dark */
|
| 205 |
+
.main-app-content-container p, .main-app-content-container li, .main-app-content-container div {
|
| 206 |
+
color: #333;
|
| 207 |
+
}
|
| 208 |
+
/* Override specific Streamlit elements that don't pick up general styles for main app */
|
| 209 |
+
.main-app-content-container .st-emotion-cache-1jmve6n, /* st.subheader */
|
| 210 |
+
.main-app-content-container .st-emotion-cache-1gcs47q, /* st.text or similar */
|
| 211 |
+
.main-app-content-container .st-emotion-cache-10q7f27, /* st.info text */
|
| 212 |
+
.main-app-content-container .st-emotion-cache-1j0qsvo { /* more specific text */
|
| 213 |
+
color: #333 !important;
|
| 214 |
+
}
|
| 215 |
+
/* Navbar Styling */
|
| 216 |
+
.navbar {
|
| 217 |
+
display: flex;
|
| 218 |
+
justify-content: center; /* Center the logo and title */
|
| 219 |
+
align-items: center;
|
| 220 |
+
padding: 15px 40px;
|
| 221 |
+
background-color: rgba(255, 255, 255, 0.8); /* Slightly transparent white */
|
| 222 |
+
backdrop-filter: blur(5px);
|
| 223 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
| 224 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
|
| 225 |
+
border-radius: 10px;
|
| 226 |
+
margin-bottom: 20px;
|
| 227 |
+
/* position: relative; Removed absolute positioning as logout button is gone */
|
| 228 |
+
}
|
| 229 |
+
.navbar-logo-container {
|
| 230 |
+
display: flex;
|
| 231 |
+
align-items: center;
|
| 232 |
+
justify-content: center; /* Center the logo and text */
|
| 233 |
+
flex-grow: 1; /* Allows it to take available space for centering */
|
| 234 |
+
}
|
| 235 |
+
.navbar-logo-text {
|
| 236 |
+
font-family: 'Merriweather', serif;
|
| 237 |
+
font-size: 24px;
|
| 238 |
+
font-weight: bold;
|
| 239 |
+
color: #1a237e;
|
| 240 |
+
margin-left: 10px; /* Space between logo image and text */
|
| 241 |
+
}
|
| 242 |
+
.navbar-logo-img {
|
| 243 |
+
height: 30px; /* Size of your logo image */
|
| 244 |
+
vertical-align: middle;
|
| 245 |
+
}
|
| 246 |
+
.navbar-links { /* This block might not be needed if links are removed */
|
| 247 |
+
display: flex;
|
| 248 |
+
gap: 30px;
|
| 249 |
+
}
|
| 250 |
+
.navbar-link { /* This block might not be needed if links are removed */
|
| 251 |
+
font-family: 'Montserrat', sans-serif;
|
| 252 |
+
font-size: 16px;
|
| 253 |
+
color: #3f51b5; /* Medium blue */
|
| 254 |
+
text-decoration: none;
|
| 255 |
+
padding: 5px 10px;
|
| 256 |
+
transition: color 0.2s ease-in-out;
|
| 257 |
+
cursor: pointer;
|
| 258 |
+
}
|
| 259 |
+
.navbar-link:hover { /* This block might not be needed if links are removed */
|
| 260 |
+
color: #6a11cb; /* Purple hover */
|
| 261 |
+
}
|
| 262 |
+
.navbar-button { /* This block might not be needed if links are removed */
|
| 263 |
+
background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%);
|
| 264 |
+
color: white;
|
| 265 |
+
border-radius: 8px;
|
| 266 |
+
padding: 8px 15px;
|
| 267 |
+
font-size: 14px;
|
| 268 |
+
font-weight: bold;
|
| 269 |
+
text-decoration: none;
|
| 270 |
+
transition: all 0.2s ease-in-out;
|
| 271 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 272 |
+
cursor: pointer;
|
| 273 |
+
}
|
| 274 |
+
.navbar-button:hover { /* This block might not be needed if links are removed */
|
| 275 |
+
transform: translateY(-1px);
|
| 276 |
+
box_shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
| 277 |
+
}
|
| 278 |
+
/* AI Powered Educational Platform banner style */
|
| 279 |
+
.ai-powered-banner {
|
| 280 |
+
display: inline-flex; /* Use inline-flex to shrink-wrap content */
|
| 281 |
+
align-items: center;
|
| 282 |
+
background-color: rgba(255, 255, 255, 0.7); /* Light, semi-transparent */
|
| 283 |
+
border-radius: 20px;
|
| 284 |
+
padding: 8px 15px;
|
| 285 |
+
margin-bottom: 20px;
|
| 286 |
+
font-size: 14px;
|
| 287 |
+
font-weight: 600;
|
| 288 |
+
color: #3f51b5; /* Blue text */
|
| 289 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
|
| 290 |
+
text-align: center; /* Ensure text is centered if container grows */
|
| 291 |
+
margin-left: auto; /* Center horizontally */
|
| 292 |
+
margin-right: auto; /* Center horizontally */
|
| 293 |
+
}
|
| 294 |
+
.centered-container {
|
| 295 |
+
display: flex;
|
| 296 |
+
justify-content: center;
|
| 297 |
+
width: 100%;
|
| 298 |
+
}
|
| 299 |
+
/* Metrics section styles (50K+ Students Helped, etc.) */
|
| 300 |
+
.metrics-container {
|
| 301 |
+
display: flex;
|
| 302 |
+
justify-content: space-around;
|
| 303 |
+
flex-wrap: wrap;
|
| 304 |
+
margin-top: 40px;
|
| 305 |
+
gap: 20px;
|
| 306 |
+
/* border: 1px solid red; REMOVED for debugging */
|
| 307 |
+
}
|
| 308 |
+
.metric-item {
|
| 309 |
+
text-align: center;
|
| 310 |
+
background-color: rgba(255, 255, 255, 0.7);
|
| 311 |
+
padding: 20px;
|
| 312 |
+
border-radius: 10px;
|
| 313 |
+
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
|
| 314 |
+
flex: 1; /* Allow items to grow/shrink */
|
| 315 |
+
min-width: 180px; /* Minimum width before wrapping */
|
| 316 |
+
}
|
| 317 |
+
.metric-item h2 {
|
| 318 |
+
font-size: 32px;
|
| 319 |
+
color: #6a11cb; /* Purple */
|
| 320 |
+
margin-bottom: 5px;
|
| 321 |
+
}
|
| 322 |
+
.metric-item p {
|
| 323 |
+
font-size: 16px;
|
| 324 |
+
color: #555;
|
| 325 |
+
}
|
| 326 |
+
.metric-item img { /* Style for icon images if used */
|
| 327 |
+
height: 40px;
|
| 328 |
+
margin-bottom: 10px;
|
| 329 |
+
}
|
| 330 |
+
/* Center plots */
|
| 331 |
+
.st-emotion-cache-1pxazr6 { /* Specific Streamlit container for pyplot */
|
| 332 |
+
display: flex;
|
| 333 |
+
justify-content: center;
|
| 334 |
+
}
|
| 335 |
+
/* Override specific Streamlit elements that don't pick up general styles */
|
| 336 |
+
.st-emotion-cache-1jmve6n { /* This class is often for st.subheader */
|
| 337 |
+
color: #1a237e !important; /* Darker blue */
|
| 338 |
+
}
|
| 339 |
+
.st-emotion-cache-1gcs47q { /* This class can be for specific text elements */
|
| 340 |
+
color: #333 !important;
|
| 341 |
+
}
|
| 342 |
+
.st-emotion-cache-10q7f27 { /* Example for st.info text */
|
| 343 |
+
color: #333 !important;
|
| 344 |
+
}
|
| 345 |
+
/* Hide the top grey bar */
|
| 346 |
+
header.st-emotion-cache-1gh8zsi {
|
| 347 |
+
display: none !important;
|
| 348 |
+
}
|
| 349 |
+
div.st-emotion-cache-fis6y8 {
|
| 350 |
+
padding-top: 0 !important;
|
| 351 |
+
}
|
| 352 |
+
div.st-emotion-cache-z5inrg {
|
| 353 |
+
display: none !important;
|
| 354 |
+
}
|
| 355 |
+
/* Adjust overall container width */
|
| 356 |
+
.st-emotion-cache-fg4lbf {
|
| 357 |
+
max-width: 1000px !important; /* Adjusted for wider layout */
|
| 358 |
+
padding-left: 0 !important;
|
| 359 |
+
padding-right: 0 !important;
|
| 360 |
+
}
|
| 361 |
+
.block-container {
|
| 362 |
+
padding-left: 1rem;
|
| 363 |
+
padding-right: 1rem;
|
| 364 |
+
color: #333; /* Default text color within block-container */
|
| 365 |
+
}
|
| 366 |
+
/* Specific style for button alignment */
|
| 367 |
+
/* Updated .button-row to stack and add spacing */
|
| 368 |
+
.button-row {
|
| 369 |
+
display: flex;
|
| 370 |
+
flex-direction: column; /* Stack buttons vertically */
|
| 371 |
+
align-items: center; /* Center buttons horizontally */
|
| 372 |
+
gap: 20px; /* Space between buttons */
|
| 373 |
+
margin-top: 20px;
|
| 374 |
+
width: 100%; /* Ensure row takes full width to center its content */
|
| 375 |
+
}
|
| 376 |
+
.button-row > div { /* Target Streamlit column divs within button-row if still used */
|
| 377 |
+
width: 100%; /* Make columns take full width to center buttons */
|
| 378 |
+
display: flex;
|
| 379 |
+
justify-content: center; /* Center the buttons inside their columns */
|
| 380 |
+
}
|
| 381 |
+
/* Custom footer style */
|
| 382 |
+
.app-footer {
|
| 383 |
+
position: fixed;
|
| 384 |
+
left: 0;
|
| 385 |
+
bottom: 0;
|
| 386 |
+
width: 100%;
|
| 387 |
+
background-color: #f0f2f6; /* Streamlit's default background color */
|
| 388 |
+
color: #31333F; /* Streamlit's default text color */
|
| 389 |
+
text-align: center;
|
| 390 |
+
padding: 10px;
|
| 391 |
+
font-size: 14px;
|
| 392 |
+
border-top: 1px solid #d3d3d3;
|
| 393 |
+
z-index: 1000; /* Ensure footer is on top */
|
| 394 |
+
}
|
| 395 |
+
/* Adjust app padding to prevent content from being hidden by footer */
|
| 396 |
+
.stApp {
|
| 397 |
+
padding-bottom: 50px; /* Approx height of footer */
|
| 398 |
+
}
|
| 399 |
+
/* History entry styling */
|
| 400 |
+
.history-entry {
|
| 401 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 402 |
+
border-radius: 10px;
|
| 403 |
+
padding: 15px;
|
| 404 |
+
margin-bottom: 10px;
|
| 405 |
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 406 |
+
border: 1px solid #e0e0e0;
|
| 407 |
+
}
|
| 408 |
+
.history-entry h4 {
|
| 409 |
+
color: #2575fc; /* Blue for history entry title */
|
| 410 |
+
margin-top: 0;
|
| 411 |
+
margin-bottom: 5px;
|
| 412 |
+
}
|
| 413 |
+
.history-entry p {
|
| 414 |
+
color: #444;
|
| 415 |
+
font-size: 0.95em;
|
| 416 |
+
}
|
| 417 |
+
.history-entry strong {
|
| 418 |
+
color: #1a237e;
|
| 419 |
+
}
|
| 420 |
+
/* New style for output text color from DilBot */
|
| 421 |
+
.dilbot-response-text {
|
| 422 |
+
color: black !important; /* Force black text */
|
| 423 |
+
}
|
| 424 |
+
</style>
|
| 425 |
+
""",
|
| 426 |
+
unsafe_allow_html=True
|
| 427 |
+
)
|
| 428 |
+
|
| 429 |
# User management functions
|
| 430 |
def hash_password(password):
|
| 431 |
"""Hash password using SHA-256 with salt"""
|
|
|
|
| 515 |
prediction = emotion_pipeline(text)[0][0]
|
| 516 |
return prediction['label'].lower(), prediction['score']
|
| 517 |
|
| 518 |
+
|
| 519 |
# Authentication UI
|
| 520 |
def show_auth_page():
|
| 521 |
+
set_background_and_styles()
|
| 522 |
+
st.markdown(
|
| 523 |
+
"""
|
| 524 |
+
<div class="navbar">
|
| 525 |
+
<div class="navbar-logo-container">
|
| 526 |
+
<img src="https://e7.pngegg.com/pngimages/498/917/png-clipart-computer-icons-desktop-chatbot-icon-blue-angle-thumbnail.png" class="navbar-logo-img">
|
| 527 |
+
<div class="navbar-logo-text">DilBot</div>
|
| 528 |
+
</div>
|
| 529 |
+
</div>
|
| 530 |
+
""", unsafe_allow_html=True
|
| 531 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
|
| 533 |
+
st.markdown("<div class='centered-container'><div class='ai-powered-banner'><span>✨</span>AI-Powered Emotional Companion</div></div>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 534 |
|
| 535 |
+
st.markdown(
|
| 536 |
+
"""
|
| 537 |
+
<h1 style='text-align: center; font-size: 3.5em; color: #1a237e;'>Transform Your Emotional Journey</h1>
|
| 538 |
+
<p style='text-align: center; font-size: 1.2em; color: #555;'>
|
| 539 |
+
DilBot empowers individuals with AI-driven insights for emotional well-being, personal growth, and self-discovery worldwide.
|
| 540 |
+
</p>
|
| 541 |
+
""", unsafe_allow_html=True
|
| 542 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
|
| 544 |
+
st.markdown('<div class="button-row">', unsafe_allow_html=True)
|
| 545 |
+
|
| 546 |
+
# Buttons placed directly in a single column layout
|
| 547 |
+
if st.button("Paid Plan", key="paid_plan_btn", use_container_width=True):
|
| 548 |
+
st.info("Paid version coming soon") # Text for paid plan button
|
| 549 |
+
st.markdown('<div class="secondary-button" style="margin-top: 20px;">', unsafe_allow_html=True) # Added margin for spacing
|
| 550 |
+
if st.button("Login Below FOR FREE", key="login_free_btn", use_container_width=True):
|
| 551 |
+
st.info("Slide down below") # Text for free login button
|
| 552 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 553 |
+
st.markdown('</div>', unsafe_allow_html=True) # Close button-row
|
| 554 |
+
|
| 555 |
+
|
| 556 |
+
# --- Section for icons and descriptions ---
|
| 557 |
+
st.markdown("<div class='feature-grid'>", unsafe_allow_html=True)
|
| 558 |
+
|
| 559 |
+
# First Image: Users vast amount satisfied (https://cdn-icons-png.flaticon.com/512/33/33308.png)
|
| 560 |
+
st.markdown(f"""
|
| 561 |
+
<div class="feature-item">
|
| 562 |
+
<img src="https://cdn-icons-png.flaticon.com/512/33/33308.png" class="icon-img">
|
| 563 |
+
<h3>Users Vastly Satisfied</h3>
|
| 564 |
+
<p>Our community experiences significant positive emotional shifts.</p>
|
| 565 |
+
</div>
|
| 566 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
| 567 |
|
| 568 |
+
# Second Image: Successful User's Emotion's results a happy lifestyle (https://cdn-icons-png.flaticon.com/512/10809/10809501.png)
|
| 569 |
+
st.markdown(f"""
|
| 570 |
+
<div class="feature-item">
|
| 571 |
+
<img src="https://cdn-icons-png.flaticon.com/512/10809/10809501.png" class="icon-img">
|
| 572 |
+
<h3>Happy Lifestyle</h3>
|
| 573 |
+
<p>Empowering users to achieve emotional well-being and a happier life.</p>
|
| 574 |
+
</div>
|
| 575 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 576 |
|
| 577 |
+
# Third Image: 10,000+ Daily Users (https://www.clipartmax.com/png/middle/225-2254363_checklist-comments-form-approved-icon.png)
|
| 578 |
+
st.markdown(f"""
|
| 579 |
+
<div class="feature-item">
|
| 580 |
+
<img src="https://www.clipartmax.com/png/middle/225-2254363_checklist-comments-form-appr.png" class="icon-img">
|
| 581 |
+
<h3>10,000+ Daily Users</h3>
|
| 582 |
+
<p>Join our growing community finding support and growth daily.</p>
|
| 583 |
+
</div>
|
| 584 |
+
""", unsafe_allow_html=True)
|
|
|
|
| 585 |
|
| 586 |
+
# Re-adding the original Empathetic Chatbot feature from previous response for completeness
|
| 587 |
+
st.markdown("""
|
| 588 |
+
<div class="feature-item">
|
| 589 |
+
<span class="icon-img">💬</span> <h3>Empathetic Chatbot</h3>
|
| 590 |
+
<p>Connect with an AI that listens and understands your feelings.</p>
|
| 591 |
+
</div>
|
| 592 |
""", unsafe_allow_html=True)
|
|
|
|
| 593 |
|
| 594 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 595 |
+
# --- End of icon and description section ---
|
|
|
|
|
|
|
| 596 |
|
|
|
|
| 597 |
|
| 598 |
+
st.markdown("<div class='auth-content-container'>", unsafe_allow_html=True) # Container for login/signup
|
| 599 |
|
| 600 |
+
tab1, tab2 = st.tabs(["Login", "Sign Up"])
|
| 601 |
+
|
| 602 |
with tab1:
|
| 603 |
st.subheader("Login to Your Account")
|
| 604 |
+
login_username = st.text_input("Username", key="login_user")
|
| 605 |
+
login_password = st.text_input("Password", type="password", key="login_pass")
|
| 606 |
+
|
| 607 |
+
if st.button("Login", key="login_btn"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
if login_username and login_password:
|
| 609 |
success, message, is_admin = login(login_username, login_password)
|
| 610 |
if success:
|
| 611 |
st.session_state.authenticated = True
|
| 612 |
st.session_state.username = login_username
|
| 613 |
st.session_state.is_admin = is_admin
|
| 614 |
+
st.session_state.page = "main_app" if not is_admin else "admin_dashboard" # Direct to correct page
|
| 615 |
st.rerun()
|
| 616 |
else:
|
| 617 |
st.error(message)
|
| 618 |
else:
|
| 619 |
st.warning("Please fill in all fields")
|
| 620 |
+
|
| 621 |
with tab2:
|
| 622 |
st.subheader("Create New Account")
|
| 623 |
+
signup_username = st.text_input("Choose Username", key="signup_user")
|
| 624 |
+
signup_email = st.text_input("Email Address", key="signup_email")
|
| 625 |
+
signup_password = st.text_input("Choose Password", type="password", key="signup_pass")
|
| 626 |
+
signup_confirm = st.text_input("Confirm Password", type="password", key="signup_confirm")
|
| 627 |
+
|
| 628 |
+
if st.button("Create Account", key="signup_btn"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
if all([signup_username, signup_email, signup_password, signup_confirm]):
|
| 630 |
if signup_password != signup_confirm:
|
| 631 |
st.error("Passwords don't match!")
|
|
|
|
| 641 |
else:
|
| 642 |
st.warning("Please fill in all fields")
|
| 643 |
|
| 644 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 645 |
+
|
| 646 |
# Main app functions
|
| 647 |
def build_user_vectorstore(username, quotes):
|
| 648 |
"""Build and save user-specific vectorstore"""
|