reab5555 commited on
Commit
e5572a4
·
verified ·
1 Parent(s): 81e2598

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -6,8 +6,7 @@ from transformers import Owlv2Processor, Owlv2ForObjectDetection
6
  import numpy as np
7
  import os
8
 
9
- # Check if CUDA is available, otherwise use CPU
10
- device = 'cuda' if torch.cuda.is_available() else 'cpu'
11
 
12
  processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16")
13
  model = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16").to(device)
@@ -65,7 +64,7 @@ def process_video(video_path, target, progress=gr.Progress()):
65
  fourcc = cv2.VideoWriter_fourcc(*'mp4v')
66
  out = cv2.VideoWriter(output_path, fourcc, output_fps, (int(cap.get(3)), int(cap.get(4))))
67
 
68
- batch_size = 64
69
  frames = []
70
 
71
  for frame in progress.tqdm(range(frame_count)):
 
6
  import numpy as np
7
  import os
8
 
9
+ device = 'cuda'
 
10
 
11
  processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16")
12
  model = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16").to(device)
 
64
  fourcc = cv2.VideoWriter_fourcc(*'mp4v')
65
  out = cv2.VideoWriter(output_path, fourcc, output_fps, (int(cap.get(3)), int(cap.get(4))))
66
 
67
+ batch_size = 128
68
  frames = []
69
 
70
  for frame in progress.tqdm(range(frame_count)):