Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,12 @@ def video_feed():
|
|
| 10 |
ret, frame = cap.read()
|
| 11 |
if not ret:
|
| 12 |
continue
|
|
|
|
| 13 |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
cap.release()
|
| 17 |
|
|
|
|
| 10 |
ret, frame = cap.read()
|
| 11 |
if not ret:
|
| 12 |
continue
|
| 13 |
+
# Convert the frame to RGB
|
| 14 |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 15 |
+
# Encode the frame as JPEG
|
| 16 |
+
_, buffer = cv2.imencode('.jpg', frame)
|
| 17 |
+
# Yield the frame as bytes
|
| 18 |
+
yield buffer.tobytes()
|
| 19 |
|
| 20 |
cap.release()
|
| 21 |
|