Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,10 @@ import numpy as np
|
|
4 |
import csv
|
5 |
from datetime import datetime
|
6 |
|
7 |
-
video_capture=cv2.VideoCapture(1)
|
8 |
-
if not video_capture.isOpened():
|
9 |
-
|
10 |
-
|
11 |
|
12 |
|
13 |
|
@@ -38,8 +38,21 @@ current_date=now.strftime("%Y-%m-%d")
|
|
38 |
f=open(current_date+'.csv','w+',newline='')
|
39 |
lnwriter=csv.writer(f)
|
40 |
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
small_frame=cv2.resize(frame,(0,0),fx=0.25,fy=0.25)
|
44 |
rgb_small_frame=small_frame[:,:,::-1]
|
45 |
if s:
|
@@ -64,6 +77,6 @@ while True:
|
|
64 |
cv2.imshow("attendence system",frame)
|
65 |
if cv2.waitKey(1) & 0xFF==ord('q'):
|
66 |
break
|
67 |
-
|
68 |
-
|
69 |
f.close()
|
|
|
4 |
import csv
|
5 |
from datetime import datetime
|
6 |
|
7 |
+
# video_capture=cv2.VideoCapture(1)
|
8 |
+
# if not video_capture.isOpened():
|
9 |
+
# print("Failed to open the video capture.")
|
10 |
+
# exit()
|
11 |
|
12 |
|
13 |
|
|
|
38 |
f=open(current_date+'.csv','w+',newline='')
|
39 |
lnwriter=csv.writer(f)
|
40 |
|
41 |
+
############################
|
42 |
+
import io
|
43 |
+
import streamlit as st
|
44 |
+
bytes_data=None
|
45 |
+
|
46 |
+
run=st.checkbox('Run')
|
47 |
+
FRAME_WINDOW=st.image([])
|
48 |
+
camera=cv2.VideoCapture(0)
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
while run:
|
55 |
+
_,frame=camera.read()
|
56 |
small_frame=cv2.resize(frame,(0,0),fx=0.25,fy=0.25)
|
57 |
rgb_small_frame=small_frame[:,:,::-1]
|
58 |
if s:
|
|
|
77 |
cv2.imshow("attendence system",frame)
|
78 |
if cv2.waitKey(1) & 0xFF==ord('q'):
|
79 |
break
|
80 |
+
else:
|
81 |
+
st.write('Stopped')
|
82 |
f.close()
|