Spaces:
Runtime error
Runtime error
Update run.py
Browse files
run.py
CHANGED
@@ -10,12 +10,10 @@ def load_hf_dataset(dataset_path, auth_token):
|
|
10 |
dataset = load_dataset(dataset_path, token=auth_token)
|
11 |
|
12 |
video_paths = dataset
|
13 |
-
print("load done")
|
14 |
|
15 |
return video_paths
|
16 |
|
17 |
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):
|
18 |
-
print("begin caption")
|
19 |
if video_src:
|
20 |
video = video_src
|
21 |
processor = VideoProcessor(frame_format=frame_format, frame_limit=frame_limit)
|
@@ -31,14 +29,12 @@ def fast_caption(sys_prompt, usr_prompt, temp, top_p, max_tokens, model, key, en
|
|
31 |
caption = api.get_caption(sys_prompt, usr_prompt, base64_list)
|
32 |
return f"{caption}", f"Using model '{model}' with {len(frames)} frames extracted.", debug_image
|
33 |
elif video_hf and video_hf_auth:
|
34 |
-
print("begin video_hf")
|
35 |
# Handle Hugging Face dataset
|
36 |
video_paths = load_hf_dataset(video_hf, video_hf_auth)
|
37 |
video_paths = video_paths["train"]
|
38 |
# Process all videos in the dataset
|
39 |
all_captions = []
|
40 |
for video_path_url in video_paths:
|
41 |
-
print("video_path")
|
42 |
video_path_url = video_path_url["id"]
|
43 |
# 使用requests下载文件到临时文件
|
44 |
response = requests.get(video_path_url, stream=True)
|
@@ -117,6 +113,9 @@ with gr.Blocks() as Core:
|
|
117 |
with gr.Tab("HF"):
|
118 |
video_hf = gr.Text(label="Huggingface File Path")
|
119 |
video_hf_auth = gr.Text(label="Huggingface Token")
|
|
|
|
|
|
|
120 |
with gr.Tab("Onedrive"):
|
121 |
video_od = gr.Text("Microsoft Onedrive")
|
122 |
video_od_auth = gr.Text(label="Microsoft Onedrive Token")
|
|
|
10 |
dataset = load_dataset(dataset_path, token=auth_token)
|
11 |
|
12 |
video_paths = dataset
|
|
|
13 |
|
14 |
return video_paths
|
15 |
|
16 |
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):
|
|
|
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 |
# Handle Hugging Face dataset
|
33 |
video_paths = load_hf_dataset(video_hf, video_hf_auth)
|
34 |
video_paths = video_paths["train"]
|
35 |
# Process all videos in the dataset
|
36 |
all_captions = []
|
37 |
for video_path_url in video_paths:
|
|
|
38 |
video_path_url = video_path_url["id"]
|
39 |
# 使用requests下载文件到临时文件
|
40 |
response = requests.get(video_path_url, stream=True)
|
|
|
113 |
with gr.Tab("HF"):
|
114 |
video_hf = gr.Text(label="Huggingface File Path")
|
115 |
video_hf_auth = gr.Text(label="Huggingface Token")
|
116 |
+
with gr.Tab("Parquet_index"):
|
117 |
+
video_hf = gr.Text(label="Parquet_index")
|
118 |
+
video_hf_auth = gr.Text(label="Huggingface Token")
|
119 |
with gr.Tab("Onedrive"):
|
120 |
video_od = gr.Text("Microsoft Onedrive")
|
121 |
video_od_auth = gr.Text(label="Microsoft Onedrive Token")
|