Giter Site home page Giter Site logo

cheeseburger9309 / attendance-system-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 258 KB

This is a Flask-based API for an attendance system. It allows users to upload images, detect faces, mark attendance, and train the face recognition model.

Python 94.98% Dockerfile 5.02%

attendance-system-api's Introduction

Attendance System API

This is a Flask-based API for an attendance system. It allows users to upload images, detect faces, mark attendance, and train the face recognition model.

Requirements

  • Python 3.7 or higher
  • OpenCV (cv2) library (opencv-contrib-python)
  • Flask library
  • NumPy library
  • SQLite3 library

Installation

  1. Clone the repository: git clone https://github.com/ganajayant/attendance-system-api.git

  2. Navigate to the project directory: cd attendance-system-api

  3. Install the required dependencies: pip install -r requirements.txt

  4. Load Schema into Database python init_db.py

Run Command

To start the Flask application, use the following command:

  • MacOS flask --app server run --debug
  • Windows python -m flask --app server run --debug

API Endpoints

Postman Documentation

Upload Images and Add User

Endpoint: /upload

Method: POST

Request Body:

  • images (multipart/form-data) - List of images to upload (maximum 10 images).
  • rollno (form-data) - Roll number of the student.
  • name (form-data) - Name of the student.
  • email (form-data) - Email of the student.

Response:

  • Success (200 OK):
{
    "message": "User added successfully & training started"
}
  • Bad Request (400):
    • If no images are found:
    {
        "message": "No images found"
    }
    
    • If more than 10 images are uploaded:
    {
        "message": "Maximum 10 images are allowed"
    }
    
    • If the request data is invalid:
    {
        "message": "Invalid data"
    }
    
    • If the user already exists:
    {
        "message": "User already exists"
    }
    
  • Internal Server Error (500):
    {
        "message": "Internal server error"
    }
    

Mark Attendance

Endpoint: /attendance

Method: POST

Request Body:

  • file (multipart/form-data) - Image file for attendance marking.

Response:

  • Success (200 OK):
{
    "message": "Attendance marked successfully"
}
  • Not Found (404):
    • If no face is found in the uploaded image:
    {
        "message": "No face found"
    }
    
    • If the user is not found in the face recognition model:
    {
        "message": "User not found"
    }
    
    • If the student attendance is already marked for the current date:
    {
        "message": "Student attendance is marked"
    }
    
  • Internal Server Error (500):
    {
        "message": "Internal server error"
    }
    

Please note that the API assumes the existence of the following directories:

uploads - for temporary image uploads

images - for storing user images

recognizer - for storing the trained face recognition model

Also, make sure to create an SQLite database file database.db in the db directory before running the application.

attendance-system-api's People

Contributors

ganajayant avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.