Skip to content

csanjana22/SnapClass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SnapClass

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.


Key Features

Teacher Portal

  • 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.

Student Portal

  • 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.

AI Biometrics Pipelines

  • Face Recognition Pipeline: Employs dlib and the face_recognition library to detect faces, extract unique facial embeddings, and compare them against reference profiles.
  • Voice Verification Pipeline: Utilizes librosa and resemblyzer to extract voice print embeddings and perform speaker verification to prevent attendance spoofing.

Project Architecture

├── .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

Technology Stack


Setup & Installation

1. Prerequisites

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

2. Clone the Repository

git clone <repository-url>
cd snapclass

3. Create a Virtual Environment

# Create venv
python -m venv venv

# Activate venv (Windows)
.\venv\Scripts\activate

# Activate venv (macOS/Linux)
source venv/bin/activate

4. Install Dependencies

pip install -r requirements.txt

5. Supabase Database Configuration

SnapClass requires a Supabase PostgreSQL instance with the following tables:

1. teachers

  • teacher_id: UUID (Primary Key, default: gen_random_uuid())
  • username: Text (Unique)
  • password: Text (Hashed using bcrypt)
  • name: Text

2. students

  • student_id: Text (Primary Key, e.g., Roll number)
  • password: Text (Hashed using bcrypt)
  • name: Text
  • section: Text
  • branch: Text
  • year: Text
  • face_embedding: Double Precision Array (Nullable, reference embedding vector)
  • voice_embedding: Double Precision Array (Nullable, reference embedding vector)

3. subjects

  • subject_id: UUID (Primary Key, default: gen_random_uuid())
  • subject_code: Text
  • name: Text
  • section: Text
  • branch: Text
  • year: Text
  • teacher_id: UUID (Foreign Key referencing teachers.teacher_id)

4. subject_students

  • id: BigInt (Primary Key, Auto-incrementing)
  • student_id: Text (Foreign Key referencing students.student_id)
  • subject_id: UUID (Foreign Key referencing subjects.subject_id)

5. attendance_logs

  • log_id: UUID (Primary Key, default: gen_random_uuid())
  • student_id: Text (Foreign Key referencing students.student_id)
  • subject_id: UUID (Foreign Key referencing subjects.subject_id)
  • timestamp: Date
  • is_present: Boolean

Environment Secrets Setup

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.


Running the App

Run the following command from the project root:

streamlit run app.py

The application will launch in your default web browser (typically at http://localhost:8501).

About

An AI-powered attendance tracking system utilizing face recognition and voice verification, built with Streamlit and Supabase.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages