Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -78,9 +78,28 @@ def attend():
|
|
78 |
csv_writer = csv.writer(csv_file)
|
79 |
|
80 |
@app.route('/at')
|
81 |
-
def
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
|
86 |
|
|
|
78 |
csv_writer = csv.writer(csv_file)
|
79 |
|
80 |
@app.route('/at')
|
81 |
+
def webcam():
|
82 |
+
# Open the webcam
|
83 |
+
cap = cv2.VideoCapture(0)
|
84 |
+
|
85 |
+
while True:
|
86 |
+
# Read frames from the webcam
|
87 |
+
ret, frame = cap.read()
|
88 |
+
|
89 |
+
# Display the frames in a window
|
90 |
+
cv2.imshow("Webcam", frame)
|
91 |
+
|
92 |
+
# Break the loop when 'q' is pressed
|
93 |
+
if cv2.waitKey(1) & 0xFF == ord('q'):
|
94 |
+
break
|
95 |
+
|
96 |
+
# Release the webcam and close the window
|
97 |
+
cap.release()
|
98 |
+
cv2.destroyAllWindows()
|
99 |
+
|
100 |
+
iface = gr.Interface(fn=webcam, inputs=None, outputs=None)
|
101 |
+
iface.launch()
|
102 |
+
|
103 |
|
104 |
|
105 |
|