import streamlit as st
import time
from PIL import Image
import base64
# Page configuration
st.set_page_config(
page_title="AI Attendance System",
page_icon="👁️",
layout="wide",
initial_sidebar_state="expanded"
)
# Custom CSS for better appearance
st.markdown("""
""", unsafe_allow_html=True)
# Header with logo
col1, col2, col3 = st.columns([1, 3, 1])
with col2:
st.markdown("
🔷 AI-Powered Attendance System
", unsafe_allow_html=True)
st.markdown("Smart Recognition • Secure • Efficient
", unsafe_allow_html=True)
# Create two columns for content
left_col, right_col = st.columns([2, 1])
with left_col:
st.markdown("", unsafe_allow_html=True)
with st.spinner('🔄 Loading Models and Connecting to Database...'):
try:
import face_rec
time.sleep(2) # Simulating loading time
st.markdown("
✅ Face Recognition Model: Loaded Successfully
", unsafe_allow_html=True)
st.markdown("
✅ Database Connection: Connected to Redis DB
", unsafe_allow_html=True)
except Exception as e:
st.error(f"Error loading system components: {e}")
st.markdown("
", unsafe_allow_html=True)
# System features
st.markdown("", unsafe_allow_html=True)
features = [
("👁️ Real-time Face Recognition", "Instant identification of registered users using advanced ML models"),
("⏱️ Automatic Attendance Logging", "Timestamps recorded automatically with entry and exit times"),
("🔐 Role-based Access Management", "Different access levels for students and teachers"),
("📊 Comprehensive Reports", "Generate detailed attendance reports with various filters"),
("⚡ High Performance", "Optimized for speed even with multiple simultaneous recognitions")
]
for icon_title, description in features:
st.markdown(f"""
{icon_title.split()[0]}
{" ".join(icon_title.split()[1:])}
{description}
""", unsafe_allow_html=True)
with right_col:
st.markdown("", unsafe_allow_html=True)
st.markdown("
Quick Navigation
", unsafe_allow_html=True)
# Quick action buttons
if st.button("📝 Register New User", use_container_width=True):
st.switch_page("pages/2_registration_form.py")
if st.button("🟢 Start Attendance Tracking", use_container_width=True):
st.switch_page("pages/1_real_time_prediction.py")
if st.button("📊 View Attendance Reports", use_container_width=True):
st.switch_page("pages/3_report.py")
st.markdown("", unsafe_allow_html=True)
# System status
st.markdown("", unsafe_allow_html=True)
st.markdown("
System Status
", unsafe_allow_html=True)
# Display some system metrics
col1, col2 = st.columns(2)
with col1:
st.metric(label="System Status", value="Online", delta="Active")
with col2:
st.metric(label="Database Status", value="Connected", delta="Active")
st.markdown("", unsafe_allow_html=True)
# Footer
st.markdown("", unsafe_allow_html=True)