Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,12 @@ Images = []
|
|
| 13 |
classnames = []
|
| 14 |
directory = "photos"
|
| 15 |
myList = os.listdir(directory)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
st.write("Photographs found in folder : ")
|
| 18 |
for cls in myList:
|
|
@@ -31,15 +37,13 @@ file_name = st.camera_input("Upload image")
|
|
| 31 |
|
| 32 |
def add_attendance(name):
|
| 33 |
username = name
|
| 34 |
-
|
| 35 |
print(current_datetime)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
with open(f'Attendance/Attendance-{current_datetime}.csv', 'w') as f:
|
| 42 |
-
f.write('Name,Time')
|
| 43 |
|
| 44 |
|
| 45 |
if file_name is not None:
|
|
|
|
| 13 |
classnames = []
|
| 14 |
directory = "photos"
|
| 15 |
myList = os.listdir(directory)
|
| 16 |
+
current_datetime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 17 |
+
if not os.path.isdir('Attendance'):
|
| 18 |
+
os.makedirs('Attendance')
|
| 19 |
+
if f'Attendance-{current_datetime}.csv' not in os.listdir('Attendance'):
|
| 20 |
+
with open(f'Attendance/Attendance-{current_datetime}.csv', 'w') as f:
|
| 21 |
+
f.write('Name,Time')
|
| 22 |
|
| 23 |
st.write("Photographs found in folder : ")
|
| 24 |
for cls in myList:
|
|
|
|
| 37 |
|
| 38 |
def add_attendance(name):
|
| 39 |
username = name
|
| 40 |
+
|
| 41 |
print(current_datetime)
|
| 42 |
|
| 43 |
+
|
| 44 |
+
with open(f'Attendance/Attendance-{datetoday}.csv', 'a') as f:
|
| 45 |
+
f.write(f'\n{username},{aadhaar},{current_datetime}')
|
| 46 |
+
|
|
|
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
if file_name is not None:
|