Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import cv2
|
3 |
import torch
|
4 |
-
import numpy as np
|
5 |
|
6 |
# Load YOLOv5 model
|
7 |
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
|
8 |
|
9 |
-
def object_detection(
|
10 |
-
cap = cv2.VideoCapture(
|
11 |
|
12 |
while True:
|
13 |
ret, frame = cap.read()
|
@@ -28,5 +27,5 @@ def object_detection(video):
|
|
28 |
|
29 |
cap.release()
|
30 |
|
31 |
-
iface = gr.Interface(fn=object_detection, inputs=gr.Video(), outputs=gr.Image(label="Object Detection"))
|
32 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import cv2
|
3 |
import torch
|
|
|
4 |
|
5 |
# Load YOLOv5 model
|
6 |
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
|
7 |
|
8 |
+
def object_detection(video_path):
|
9 |
+
cap = cv2.VideoCapture(video_path)
|
10 |
|
11 |
while True:
|
12 |
ret, frame = cap.read()
|
|
|
27 |
|
28 |
cap.release()
|
29 |
|
30 |
+
iface = gr.Interface(fn=object_detection, inputs=gr.Video(label="Upload Video"), outputs=gr.Image(label="Object Detection"))
|
31 |
iface.launch()
|