Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,100 +24,101 @@ app = Flask(__name__)
|
|
24 |
|
25 |
@app.route('/at')
|
26 |
def testme():
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
-
def attend():
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
56 |
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
-
|
75 |
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
94 |
-
|
95 |
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
|
106 |
-
|
107 |
-
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
|
117 |
-
|
118 |
-
|
119 |
|
120 |
-
|
121 |
|
122 |
|
123 |
|
|
|
24 |
|
25 |
@app.route('/at')
|
26 |
def testme():
|
27 |
+
return "i am in testme"
|
28 |
+
# img_file_buffer=st.camera_input("Take a picture")
|
29 |
+
# if img_file_buffer is not None:
|
30 |
+
# test_image = Image.open(img_file_buffer)
|
31 |
+
# st.image(test_image, use_column_width=True)
|
32 |
+
# if bytes_data is None:
|
33 |
+
# st.stop()
|
34 |
|
35 |
+
# def attend():
|
36 |
+
# # Face recognition variables
|
37 |
+
# known_faces_names = ["Sarwan Sir", "Vikas","Lalit","Jasmeen","Anita Ma'am"]
|
38 |
+
# known_face_encodings = []
|
39 |
|
40 |
+
# # Load known face encodings
|
41 |
+
# sir_image = face_recognition.load_image_file("photos/sir.jpeg")
|
42 |
+
# sir_encoding = face_recognition.face_encodings(sir_image)[0]
|
43 |
|
44 |
+
# vikas_image = face_recognition.load_image_file("photos/vikas.jpg")
|
45 |
+
# vikas_encoding = face_recognition.face_encodings(vikas_image)[0]
|
46 |
|
47 |
+
# lalit_image = face_recognition.load_image_file("photos/lalit.jpg")
|
48 |
+
# lalit_encoding = face_recognition.face_encodings(lalit_image)[0]
|
49 |
|
50 |
+
# jasmine_image = face_recognition.load_image_file("photos/jasmine.jpg")
|
51 |
+
# jasmine_encoding = face_recognition.face_encodings(jasmine_image)[0]
|
52 |
|
53 |
+
# maam_image = face_recognition.load_image_file("photos/maam.png")
|
54 |
+
# maam_encoding = face_recognition.face_encodings(maam_image)[0]
|
55 |
|
56 |
+
# known_face_encodings = [sir_encoding, vikas_encoding,lalit_encoding,jasmine_encoding,maam_encoding]
|
57 |
|
58 |
+
# students = known_faces_names.copy()
|
59 |
|
60 |
+
# face_locations = []
|
61 |
+
# face_encodings = []
|
62 |
+
# face_names = []
|
63 |
|
64 |
+
# now = datetime.now()
|
65 |
+
# current_date = now.strftime("%Y-%m-%d")
|
66 |
+
# csv_file = open(f"{current_date}.csv", "a+", newline="")
|
67 |
|
68 |
+
# csv_writer = csv.writer(csv_file)
|
69 |
|
70 |
+
# # Function to run face recognition
|
71 |
+
# def run_face_recognition():
|
72 |
+
# video_capture = cv2.VideoCapture(0)
|
73 |
+
# s = True
|
74 |
|
75 |
+
# existing_names = set(row[0] for row in csv.reader(csv_file)) # Collect existing names from the CSV file
|
76 |
|
77 |
|
78 |
+
# while s:
|
79 |
+
# _, frame = video_capture.read()
|
80 |
+
# small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
|
81 |
+
# rgb_small_frame = small_frame[:, :, ::-1]
|
82 |
|
83 |
+
# face_locations = face_recognition.face_locations(rgb_small_frame)
|
84 |
+
# face_encodings = face_recognition.face_encodings(small_frame, face_locations)
|
85 |
+
# face_names = []
|
86 |
|
87 |
+
# for face_encoding in face_encodings:
|
88 |
+
# matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
|
89 |
+
# name = ""
|
90 |
+
# face_distance = face_recognition.face_distance(known_face_encodings, face_encoding)
|
91 |
+
# best_match_index = np.argmin(face_distance)
|
92 |
+
# if matches[best_match_index]:
|
93 |
+
# name = known_faces_names[best_match_index]
|
94 |
|
95 |
+
# face_names.append(name)
|
96 |
|
97 |
|
98 |
+
# for name in face_names:
|
99 |
+
# if name in known_faces_names and name in students and name not in existing_names:
|
100 |
+
# students.remove(name)
|
101 |
+
# print(students)
|
102 |
+
# print(f"Attendance recorded for {name}")
|
103 |
+
# current_time = now.strftime("%H-%M-%S")
|
104 |
+
# csv_writer.writerow([name, current_time, "Present"])
|
105 |
+
# existing_names.add(name) # Add the name to the set of existing names
|
106 |
|
107 |
+
# s = False # Set s to False to exit the loop after recording attendance
|
108 |
+
# break # Break the loop once attendance has been recorded for a name
|
109 |
|
110 |
+
# cv2.imshow("Attendance System", frame)
|
111 |
+
# if cv2.waitKey(1) & 0xFF == ord('q'):
|
112 |
+
# break
|
113 |
|
114 |
+
# video_capture.release()
|
115 |
+
# cv2.destroyAllWindows()
|
116 |
+
# csv_file.close()
|
117 |
|
118 |
+
# # Call the function to run face recognition
|
119 |
+
# run_face_recognition()
|
120 |
|
121 |
+
# return redirect(url_for('show_table'))
|
122 |
|
123 |
|
124 |
|