Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,12 +5,12 @@ def video_feed():
|
|
| 5 |
cap = cv2.VideoCapture(0) # Use 0 for the default camera
|
| 6 |
if not cap.isOpened():
|
| 7 |
raise RuntimeError("Could not start camera.")
|
|
|
|
| 8 |
while True:
|
| 9 |
ret, frame = cap.read()
|
| 10 |
if not ret:
|
| 11 |
continue
|
| 12 |
-
|
| 13 |
-
frame = buffer.tobytes()
|
| 14 |
yield frame
|
| 15 |
|
| 16 |
cap.release()
|
|
|
|
| 5 |
cap = cv2.VideoCapture(0) # Use 0 for the default camera
|
| 6 |
if not cap.isOpened():
|
| 7 |
raise RuntimeError("Could not start camera.")
|
| 8 |
+
|
| 9 |
while True:
|
| 10 |
ret, frame = cap.read()
|
| 11 |
if not ret:
|
| 12 |
continue
|
| 13 |
+
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
|
|
|
| 14 |
yield frame
|
| 15 |
|
| 16 |
cap.release()
|