Update utils/object_detection_brainai.py
Browse files
utils/object_detection_brainai.py
CHANGED
|
@@ -43,10 +43,10 @@ class ObjectDetectionModel():
|
|
| 43 |
return img_plot, f'Objects Detected: {", ".join(detected_classes) if detected_classes else "No objects detected"}'
|
| 44 |
|
| 45 |
def play_video(self, input_video):
|
| 46 |
-
|
| 47 |
temporary_location = "upload.mp4"
|
| 48 |
with open(temporary_location, "wb") as out:
|
| 49 |
-
out.write(
|
| 50 |
out.close()
|
| 51 |
|
| 52 |
camera = cv2.VideoCapture(temporary_location)
|
|
|
|
| 43 |
return img_plot, f'Objects Detected: {", ".join(detected_classes) if detected_classes else "No objects detected"}'
|
| 44 |
|
| 45 |
def play_video(self, input_video):
|
| 46 |
+
uploaded_video = io.BytesIO(input_video.read())
|
| 47 |
temporary_location = "upload.mp4"
|
| 48 |
with open(temporary_location, "wb") as out:
|
| 49 |
+
out.write(uploaded_video.read())
|
| 50 |
out.close()
|
| 51 |
|
| 52 |
camera = cv2.VideoCapture(temporary_location)
|