Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ try:
|
|
| 3 |
except:
|
| 4 |
import os
|
| 5 |
os.system('pip install git+https://github.com/facebookresearch/detectron2.git')
|
| 6 |
-
|
| 7 |
import cv2
|
| 8 |
import supervision as sv
|
| 9 |
import torch
|
|
@@ -51,7 +51,7 @@ def predict_frame(frame,_):
|
|
| 51 |
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
|
| 52 |
return out.get_image()
|
| 53 |
|
| 54 |
-
|
| 55 |
def inference(image_url, image, min_score):
|
| 56 |
if not torch.cuda.is_available():
|
| 57 |
cfg.MODEL.DEVICE = "cpu"
|
|
@@ -77,7 +77,7 @@ def inference(image_url, image, min_score):
|
|
| 77 |
|
| 78 |
return out.get_image()
|
| 79 |
|
| 80 |
-
|
| 81 |
def process_vid(video_path):
|
| 82 |
|
| 83 |
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.3
|
|
|
|
| 3 |
except:
|
| 4 |
import os
|
| 5 |
os.system('pip install git+https://github.com/facebookresearch/detectron2.git')
|
| 6 |
+
import spaces
|
| 7 |
import cv2
|
| 8 |
import supervision as sv
|
| 9 |
import torch
|
|
|
|
| 51 |
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
|
| 52 |
return out.get_image()
|
| 53 |
|
| 54 |
+
@spaces.GPU
|
| 55 |
def inference(image_url, image, min_score):
|
| 56 |
if not torch.cuda.is_available():
|
| 57 |
cfg.MODEL.DEVICE = "cpu"
|
|
|
|
| 77 |
|
| 78 |
return out.get_image()
|
| 79 |
|
| 80 |
+
@spaces.GPU
|
| 81 |
def process_vid(video_path):
|
| 82 |
|
| 83 |
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.3
|