Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,9 +4,18 @@ import face_recognition
|
|
| 4 |
import cv2
|
| 5 |
import numpy as np
|
| 6 |
import os
|
|
|
|
| 7 |
from datetime import datetime
|
| 8 |
import CSV
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
st.title("AIMLJan24 - Face Recognition")
|
| 11 |
|
| 12 |
# Load images for face recognition
|
|
@@ -36,13 +45,14 @@ encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
|
|
| 36 |
# camera to take photo of user in question
|
| 37 |
file_name = st.camera_input("Upload image")
|
| 38 |
|
| 39 |
-
def add_attendance(
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
if file_name is not None:
|
|
|
|
| 4 |
import cv2
|
| 5 |
import numpy as np
|
| 6 |
import os
|
| 7 |
+
import sqlite3
|
| 8 |
from datetime import datetime
|
| 9 |
import CSV
|
| 10 |
|
| 11 |
+
conn = sqlite3.connect('attendance.db')
|
| 12 |
+
c = conn.cursor()
|
| 13 |
+
|
| 14 |
+
# Create a table for storing attendance if it doesn't exist
|
| 15 |
+
c.execute('''CREATE TABLE IF NOT EXISTS attendance
|
| 16 |
+
(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, time TEXT)''')
|
| 17 |
+
|
| 18 |
+
|
| 19 |
st.title("AIMLJan24 - Face Recognition")
|
| 20 |
|
| 21 |
# Load images for face recognition
|
|
|
|
| 45 |
# camera to take photo of user in question
|
| 46 |
file_name = st.camera_input("Upload image")
|
| 47 |
|
| 48 |
+
def add_attendance(name):
|
| 49 |
+
username = name
|
| 50 |
+
|
| 51 |
+
print(current_datetime)
|
| 52 |
+
|
| 53 |
+
# Insert data into the attendance table
|
| 54 |
+
c.execute("INSERT INTO attendance (name, time) VALUES (?, ?)", (username, current_datetime))
|
| 55 |
+
conn.commit()
|
| 56 |
|
| 57 |
|
| 58 |
if file_name is not None:
|