Spaces:
Runtime error
Runtime error
Update run.py
Browse files
run.py
CHANGED
|
@@ -35,9 +35,18 @@ def fast_caption(sys_prompt, usr_prompt, temp, top_p, max_tokens, model, key, en
|
|
| 35 |
video_paths = video_paths["train"]
|
| 36 |
# Process all videos in the dataset
|
| 37 |
all_captions = []
|
| 38 |
-
for
|
| 39 |
print("video_path")
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
if video_path.endswith('.mp4'): # 假设我们只处理.mp4文件
|
| 42 |
processor = VideoProcessor(frame_format=frame_format, frame_limit=frame_limit)
|
| 43 |
frames = processor._decode(video_path)
|
|
|
|
| 35 |
video_paths = video_paths["train"]
|
| 36 |
# Process all videos in the dataset
|
| 37 |
all_captions = []
|
| 38 |
+
for video_path_url in video_paths:
|
| 39 |
print("video_path")
|
| 40 |
+
video_path_url = video_path_url["id"]
|
| 41 |
+
# 使用requests下载文件到临时文件
|
| 42 |
+
response = requests.get(video_url, stream=True)
|
| 43 |
+
if response.status_code == 200:
|
| 44 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as temp_video_file:
|
| 45 |
+
temp_video_file.write(response.content)
|
| 46 |
+
video_path = temp_video_file.name
|
| 47 |
+
else:
|
| 48 |
+
raise Exception(f"Failed to download video, status code: {response.status_code}")
|
| 49 |
+
|
| 50 |
if video_path.endswith('.mp4'): # 假设我们只处理.mp4文件
|
| 51 |
processor = VideoProcessor(frame_format=frame_format, frame_limit=frame_limit)
|
| 52 |
frames = processor._decode(video_path)
|