Update app.py
Browse files
app.py
CHANGED
@@ -23,16 +23,14 @@ def run_commands():
|
|
23 |
except subprocess.CalledProcessError as e:
|
24 |
print(f"Command '{command}' failed with error: {e.stderr.decode()}")
|
25 |
|
26 |
-
|
27 |
|
28 |
from typing import List
|
29 |
from Utils import get_video_properties
|
30 |
-
from GroundingDINO.groundingdino.util.inference import load_model, predict
|
31 |
import cv2
|
32 |
import numpy as np
|
33 |
import torch
|
34 |
from PIL import Image
|
35 |
-
import GroundingDINO.groundingdino.datasets.transforms as T
|
36 |
from torchvision.ops import box_convert
|
37 |
from torchvision import transforms
|
38 |
from torch import nn
|
@@ -218,9 +216,12 @@ class VideoObjectDetection:
|
|
218 |
time.sleep(time_to_wait)
|
219 |
|
220 |
frame_count += 1
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
|
|
224 |
|
225 |
video_annotator = VideoObjectDetection(
|
226 |
text_prompt='human face')
|
@@ -233,4 +234,9 @@ if __name__ == "__main__":
|
|
233 |
outputs=output_image)
|
234 |
|
235 |
iface.launch(share=False, debug=True)
|
|
|
|
|
|
|
|
|
|
|
236 |
|
|
|
23 |
except subprocess.CalledProcessError as e:
|
24 |
print(f"Command '{command}' failed with error: {e.stderr.decode()}")
|
25 |
|
26 |
+
|
27 |
|
28 |
from typing import List
|
29 |
from Utils import get_video_properties
|
|
|
30 |
import cv2
|
31 |
import numpy as np
|
32 |
import torch
|
33 |
from PIL import Image
|
|
|
34 |
from torchvision.ops import box_convert
|
35 |
from torchvision import transforms
|
36 |
from torch import nn
|
|
|
216 |
time.sleep(time_to_wait)
|
217 |
|
218 |
frame_count += 1
|
219 |
+
|
220 |
+
@spaces.GPU()
|
221 |
+
def pipeline_to_setup_with_gpu():
|
222 |
+
run_commands()
|
223 |
+
from GroundingDINO.groundingdino.util.inference import load_model, predict
|
224 |
+
import GroundingDINO.groundingdino.datasets.transforms as T
|
225 |
|
226 |
video_annotator = VideoObjectDetection(
|
227 |
text_prompt='human face')
|
|
|
234 |
outputs=output_image)
|
235 |
|
236 |
iface.launch(share=False, debug=True)
|
237 |
+
|
238 |
+
|
239 |
+
if __name__ == "__main__":
|
240 |
+
pipeline_to_setup_with_gpu()
|
241 |
+
|
242 |
|