lalalalalalalalalala commited on
Commit
98d1f42
·
verified ·
1 Parent(s): 31c66a7

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +4 -0
run.py CHANGED
@@ -8,10 +8,12 @@ def load_hf_dataset(dataset_path, auth_token):
8
  dataset = load_dataset(dataset_path, token=auth_token)
9
 
10
  video_paths = dataset
 
11
 
12
  return video_paths
13
 
14
  def fast_caption(sys_prompt, usr_prompt, temp, top_p, max_tokens, model, key, endpoint, video_src, video_hf, video_hf_auth, video_od, video_od_auth, video_gd, video_gd_auth, frame_format, frame_limit):
 
15
  if video_src:
16
  video = video_src
17
  processor = VideoProcessor(frame_format=frame_format, frame_limit=frame_limit)
@@ -27,11 +29,13 @@ def fast_caption(sys_prompt, usr_prompt, temp, top_p, max_tokens, model, key, en
27
  caption = api.get_caption(sys_prompt, usr_prompt, base64_list)
28
  return f"{caption}", f"Using model '{model}' with {len(frames)} frames extracted.", debug_image
29
  elif video_hf and video_hf_auth:
 
30
  # Handle Hugging Face dataset
31
  video_paths = load_hf_dataset(video_hf, video_hf_auth)
32
  # Process all videos in the dataset
33
  all_captions = []
34
  for video_path in video_paths:
 
35
  if video_path.endswith('.mp4'): # 假设我们只处理.mp4文件
36
  processor = VideoProcessor(frame_format=frame_format, frame_limit=frame_limit)
37
  frames = processor._decode(video_path)
 
8
  dataset = load_dataset(dataset_path, token=auth_token)
9
 
10
  video_paths = dataset
11
+ print("load done")
12
 
13
  return video_paths
14
 
15
  def fast_caption(sys_prompt, usr_prompt, temp, top_p, max_tokens, model, key, endpoint, video_src, video_hf, video_hf_auth, video_od, video_od_auth, video_gd, video_gd_auth, frame_format, frame_limit):
16
+ print("begin caption")
17
  if video_src:
18
  video = video_src
19
  processor = VideoProcessor(frame_format=frame_format, frame_limit=frame_limit)
 
29
  caption = api.get_caption(sys_prompt, usr_prompt, base64_list)
30
  return f"{caption}", f"Using model '{model}' with {len(frames)} frames extracted.", debug_image
31
  elif video_hf and video_hf_auth:
32
+ print("begin video_hf")
33
  # Handle Hugging Face dataset
34
  video_paths = load_hf_dataset(video_hf, video_hf_auth)
35
  # Process all videos in the dataset
36
  all_captions = []
37
  for video_path in video_paths:
38
+ print("video_path")
39
  if video_path.endswith('.mp4'): # 假设我们只处理.mp4文件
40
  processor = VideoProcessor(frame_format=frame_format, frame_limit=frame_limit)
41
  frames = processor._decode(video_path)