Update app.py
Browse files
app.py
CHANGED
@@ -11,18 +11,12 @@ import tempfile
|
|
11 |
import shutil
|
12 |
|
13 |
# Check if CUDA is available, otherwise use CPU
|
14 |
-
device =
|
15 |
|
16 |
processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16")
|
17 |
model = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16")
|
18 |
|
19 |
-
|
20 |
-
try:
|
21 |
-
model = model.to(device).half()
|
22 |
-
except RuntimeError:
|
23 |
-
print("GPU out of memory, using CPU instead")
|
24 |
-
device = torch.device("cpu")
|
25 |
-
model = model.to(device)
|
26 |
|
27 |
@spaces.GPU(duration=120)
|
28 |
def process_video(video_path, target, progress=gr.Progress()):
|
|
|
11 |
import shutil
|
12 |
|
13 |
# Check if CUDA is available, otherwise use CPU
|
14 |
+
device = "cuda"
|
15 |
|
16 |
processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16")
|
17 |
model = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16")
|
18 |
|
19 |
+
model = model.to(device).half()
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
@spaces.GPU(duration=120)
|
22 |
def process_video(video_path, target, progress=gr.Progress()):
|