Making Attendance Faster and More Secure Using AI
SnapClass is an AI-powered smart attendance tracking web application built with Streamlit and backed by Supabase. It automates student attendance check-ins by using a double-layered biometric verification system: Face Recognition and Voice Verification.
- Subject Management: Create new subjects and specify target sections, branch, and class years.
- Student Enrollment: Share subject enrollment codes or manage student enrollments.
- Attendance Control: Start attendance sessions, view automated verification results, and manually override check-in logs if needed.
- History & Logs: Access comprehensive attendance history sorted by date and subjects.
- Profile Registration: Register/upload reference photos and voice biometrics for recognition.
- Smart Check-in: Authenticate check-ins with real-time biometric verification pipelines.
- Attendance Insights: View subject-wise attendance percentages and individual logs.
- Face Recognition Pipeline: Employs
dliband theface_recognitionlibrary to detect faces, extract unique facial embeddings, and compare them against reference profiles. - Voice Verification Pipeline: Utilizes
librosaandresemblyzerto extract voice print embeddings and perform speaker verification to prevent attendance spoofing.
├── .streamlit/
│ └── secrets.toml # Secret configuration (Supabase credentials)
├── scratch/ # Scratch and database inspection scripts
├── src/
│ ├── components/ # Reusable UI components and modal dialogs
│ │ ├── dialog_add_photo.py
│ │ ├── dialog_attendance_results.py
│ │ ├── dialog_auto_enroll.py
│ │ ├── dialog_create_subject.py
│ │ ├── dialog_enroll.py
│ │ ├── dialog_share_subject.py
│ │ ├── dialog_voice_attendance.py
│ │ ├── footer.py
│ │ ├── header.py
│ │ └── subject_card.py
│ ├── database/ # Database access layer and Supabase integration
│ │ ├── config.py
│ │ └── db.py
│ ├── pipelines/ # AI biometrics pipelines
│ │ ├── face_pipeline.py
│ │ └── voice_pipeline.py
│ ├── screens/ # App screen layouts
│ │ ├── home_screen.py
│ │ ├── student_screen.py
│ │ └── teacher_screen.py
│ └── ui/ # Shared UI layouts and icons
│ ├── base_layout.py
│ └── icons.py
├── app.py # Main application entrypoint
├── requirements.txt # Python project dependencies
└── .gitignore # Git untracked file configurations
- Frontend: Streamlit (Python-based web app framework)
- Database / Auth: Supabase (PostgreSQL backend)
- Biometric Processing:
- Utilities: NumPy, Pandas, Pillow, Bcrypt, Segno (QR Code generation)
Before installing the Python packages, ensure you have CMake and a C++ Compiler installed, as they are required to compile dlib.
- Windows: Install Visual Studio Build Tools and select the "Desktop development with C++" workload.
- macOS: Install Xcode Command Line Tools:
xcode-select --install
- Linux: Install development tools:
sudo apt-get install build-essential cmake libopenblas-dev liblapack-dev
git clone <repository-url>
cd snapclass# Create venv
python -m venv venv
# Activate venv (Windows)
.\venv\Scripts\activate
# Activate venv (macOS/Linux)
source venv/bin/activatepip install -r requirements.txtSnapClass requires a Supabase PostgreSQL instance with the following tables:
teacher_id: UUID (Primary Key, default:gen_random_uuid())username: Text (Unique)password: Text (Hashed using bcrypt)name: Text
student_id: Text (Primary Key, e.g., Roll number)password: Text (Hashed using bcrypt)name: Textsection: Textbranch: Textyear: Textface_embedding: Double Precision Array (Nullable, reference embedding vector)voice_embedding: Double Precision Array (Nullable, reference embedding vector)
subject_id: UUID (Primary Key, default:gen_random_uuid())subject_code: Textname: Textsection: Textbranch: Textyear: Textteacher_id: UUID (Foreign Key referencingteachers.teacher_id)
id: BigInt (Primary Key, Auto-incrementing)student_id: Text (Foreign Key referencingstudents.student_id)subject_id: UUID (Foreign Key referencingsubjects.subject_id)
log_id: UUID (Primary Key, default:gen_random_uuid())student_id: Text (Foreign Key referencingstudents.student_id)subject_id: UUID (Foreign Key referencingsubjects.subject_id)timestamp: Dateis_present: Boolean
Create a .streamlit/secrets.toml file in the root of the project to allow the application to connect to Supabase:
SUPABASE_URL = "https://your-supabase-project.supabase.co"
SUPABASE_KEY = "your-supabase-anon-or-service-role-key"Note: The .gitignore file is pre-configured to ensure that your secrets.toml credentials are never committed.
Run the following command from the project root:
streamlit run app.pyThe application will launch in your default web browser (typically at http://localhost:8501).