Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,23 +19,15 @@ st.success("Success")
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
|
| 35 |
-
# Display the resulting frame
|
| 36 |
-
cv.imshow('frame', gray)
|
| 37 |
-
if cv.waitKey(1) == ord('q'):
|
| 38 |
-
break
|
| 39 |
-
# When everything done, release the capture
|
| 40 |
-
cap.release()
|
| 41 |
-
cv.destroyAllWindows()
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
+
|
| 23 |
+
st.title("Webcam Live Feed")
|
| 24 |
+
run = st.checkbox('Run')
|
| 25 |
+
FRAME_WINDOW = st.image([])
|
| 26 |
+
camera = cv2.VideoCapture(0)
|
| 27 |
+
|
| 28 |
+
while run:
|
| 29 |
+
_, frame = camera.read()
|
| 30 |
+
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 31 |
+
FRAME_WINDOW.image(frame)
|
| 32 |
+
else:
|
| 33 |
+
st.write('Stopped')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|