Spaces:
Sleeping
Sleeping
Commit
·
53e5a1a
1
Parent(s):
4a4c7c1
Update app.py
Browse files
app.py
CHANGED
@@ -14,28 +14,30 @@ from IPython.display import Audio
|
|
14 |
|
15 |
# Using captured images
|
16 |
|
17 |
-
|
18 |
-
cap = cv2.VideoCapture(0) # 0 corresponds to the default camera (usually your webcam)
|
19 |
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
-
|
33 |
-
cv2.destroyAllWindows()
|
34 |
|
35 |
-
|
36 |
-
|
|
|
37 |
|
38 |
-
image=
|
39 |
|
40 |
|
41 |
# Using the pre-trained Dog Breed Identification Model
|
|
|
14 |
|
15 |
# Using captured images
|
16 |
|
17 |
+
import cv2
|
|
|
18 |
|
19 |
+
# Open a connection to the webcam (0 is usually the default webcam)
|
20 |
+
cap = cv2.VideoCapture(0)
|
21 |
|
22 |
+
# Check if the webcam is opened successfully
|
23 |
+
if not cap.isOpened():
|
24 |
+
print("Error: Could not open the webcam.")
|
25 |
+
exit()
|
26 |
|
27 |
+
while True:
|
28 |
+
# Read a frame from the webcam
|
29 |
+
ret, frame = cap.read()
|
30 |
|
31 |
+
# Display the captured frame
|
32 |
+
cv2.imshow('Webcam', frame)
|
33 |
|
34 |
+
break
|
|
|
35 |
|
36 |
+
# Release the webcam and close the OpenCV windows
|
37 |
+
cap.release()
|
38 |
+
cv2.destroyAllWindows()
|
39 |
|
40 |
+
image=frame
|
41 |
|
42 |
|
43 |
# Using the pre-trained Dog Breed Identification Model
|