annading commited on
Commit
a62341e
·
1 Parent(s): ca1863b

added simple progress bar

Browse files
Files changed (2) hide show
  1. app_batch.py +4 -2
  2. owl_batch.py +4 -2
app_batch.py CHANGED
@@ -25,7 +25,8 @@ def run_owl_batch(
25
  species_prompt: str,
26
  conf_threshold: float,
27
  fps_processed: int,
28
- scaling_factor: float
 
29
  ) -> tuple[str, str, str]:
30
  """
31
  args:
@@ -65,7 +66,8 @@ def run_owl_batch(
65
  fps_processed=fps_processed,
66
  scaling_factor=1/scaling_factor,
67
  batch_size=BATCH_SIZE,
68
- save_dir=f"temp_{timestamp}")
 
69
 
70
  end_time = time.time()
71
  print(f'Processing time: {end_time - start_time} seconds')
 
25
  species_prompt: str,
26
  conf_threshold: float,
27
  fps_processed: int,
28
+ scaling_factor: float,
29
+ progress=gr.Progress()
30
  ) -> tuple[str, str, str]:
31
  """
32
  args:
 
66
  fps_processed=fps_processed,
67
  scaling_factor=1/scaling_factor,
68
  batch_size=BATCH_SIZE,
69
+ save_dir=f"temp_{timestamp}",
70
+ progress=progress)
71
 
72
  end_time = time.time()
73
  print(f'Processing time: {end_time - start_time} seconds')
owl_batch.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import shutil
3
  from tqdm import tqdm
4
  import cv2
 
5
  import pandas as pd
6
  import torch
7
  from PIL import Image
@@ -18,14 +19,15 @@ def owl_batch_video(
18
  fps_processed: int = 1,
19
  scaling_factor: float = 0.5,
20
  batch_size: int = 8,
21
- save_dir: str = "temp/"
 
22
  ):
23
  pos_preds = []
24
  neg_preds = []
25
 
26
  df = pd.DataFrame(columns=["video path", "detection?"])
27
 
28
- for vid in input_vids:
29
  detection = owl_video_detection(vid,
30
  target_prompt,
31
  species_prompt,
 
2
  import shutil
3
  from tqdm import tqdm
4
  import cv2
5
+ import gradio as gr
6
  import pandas as pd
7
  import torch
8
  from PIL import Image
 
19
  fps_processed: int = 1,
20
  scaling_factor: float = 0.5,
21
  batch_size: int = 8,
22
+ save_dir: str = "temp/",
23
+ progress=gr.Progress()
24
  ):
25
  pos_preds = []
26
  neg_preds = []
27
 
28
  df = pd.DataFrame(columns=["video path", "detection?"])
29
 
30
+ for vid in progress.tqdm(input_vids, desc="Processing videos"):
31
  detection = owl_video_detection(vid,
32
  target_prompt,
33
  species_prompt,