Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ from datetime import datetime
|
|
| 8 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
|
| 9 |
|
| 10 |
def detect_video(video):
|
| 11 |
-
cap = cv2.VideoCapture(video
|
| 12 |
|
| 13 |
# List to hold results
|
| 14 |
detection_results = []
|
|
@@ -39,7 +39,7 @@ def detect_video(video):
|
|
| 39 |
|
| 40 |
# Gradio Interface
|
| 41 |
interface = gr.Interface(fn=detect_video,
|
| 42 |
-
inputs=gr.Video(), #
|
| 43 |
outputs="json",
|
| 44 |
live=True,
|
| 45 |
title="YOLOv5 Video Object Detection",
|
|
|
|
| 8 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
|
| 9 |
|
| 10 |
def detect_video(video):
|
| 11 |
+
cap = cv2.VideoCapture(video) # Directly use the video path
|
| 12 |
|
| 13 |
# List to hold results
|
| 14 |
detection_results = []
|
|
|
|
| 39 |
|
| 40 |
# Gradio Interface
|
| 41 |
interface = gr.Interface(fn=detect_video,
|
| 42 |
+
inputs=gr.Video(), # Correct input
|
| 43 |
outputs="json",
|
| 44 |
live=True,
|
| 45 |
title="YOLOv5 Video Object Detection",
|