Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,10 @@ import torch
|
|
7 |
import time
|
8 |
import numpy as np
|
9 |
import uuid
|
|
|
10 |
model = YOLO("yolov8s.pt")
|
11 |
|
|
|
12 |
def stream_object_detection(video):
|
13 |
cap = cv2.VideoCapture(video)
|
14 |
# This means we will output mp4 videos
|
@@ -48,4 +50,4 @@ with gr.Blocks() as app:
|
|
48 |
btn = gr.Button()
|
49 |
outp_v = gr.Video(label="Processed Video", streaming=True, autoplay=True)
|
50 |
btn.click(stream_object_detection,inp,[outp_v])
|
51 |
-
app.queue(
|
|
|
7 |
import time
|
8 |
import numpy as np
|
9 |
import uuid
|
10 |
+
import spaces
|
11 |
model = YOLO("yolov8s.pt")
|
12 |
|
13 |
+
@spaces.GPU
|
14 |
def stream_object_detection(video):
|
15 |
cap = cv2.VideoCapture(video)
|
16 |
# This means we will output mp4 videos
|
|
|
50 |
btn = gr.Button()
|
51 |
outp_v = gr.Video(label="Processed Video", streaming=True, autoplay=True)
|
52 |
btn.click(stream_object_detection,inp,[outp_v])
|
53 |
+
app.queue().launch()
|