new_space / app.py
KIRUTHICKBJ's picture
Update app.py
4cf2ff8 verified
import streamlit as st
from supabase import create_client
from main import stress_detection_app
from supabase import create_client
url = "https://jhiwacxnjyanhxwcdwne.supabase.co"
key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpoaXdhY3huanlhbmh4d2Nkd25lIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc0NTA1ODQxMSwiZXhwIjoyMDYwNjM0NDExfQ.gHQhrey_g1wOXuM69YmqT7AAXNPj5dp_EGBYbDmPTuA" # Use the new API key here
supabase = create_client(url, key)
USER_CREDENTIALS = {"kiruthick": "vibes", "admin": "admin123"}
if 'logged_in' not in st.session_state:
st.session_state.logged_in = False
#def add_custom_css():
# with open("style.css") as f:
# st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
def login():
# add_custom_css()
st.markdown("<h1>πŸ” EEG Stress Detection Login</h1>", unsafe_allow_html=True)
with st.container():
username = st.text_input("πŸ‘€ Username", placeholder="Enter your username")
password = st.text_input("πŸ”‘ Password", type="password", placeholder="Enter your password")
if st.button("Login"):
if username in USER_CREDENTIALS and USER_CREDENTIALS[username] == password:
st.success("βœ… Login Successful!")
st.session_state.logged_in = True
st.session_state.user_id = username # Store user ID for prediction logging
else:
st.error("❌ Invalid username or password")
# Show login or app
if not st.session_state.logged_in:
login()
else:
stress_detection_app()