Datasets:
Update download_videos.py
Browse files- download_videos.py +6 -9
download_videos.py
CHANGED
@@ -2,7 +2,7 @@ from huggingface_hub import hf_hub_download
|
|
2 |
import zipfile
|
3 |
import os
|
4 |
|
5 |
-
def download_and_extract_videos(dataset_name, output_dir,
|
6 |
# Create output directory if it doesn't exist
|
7 |
os.makedirs(output_dir, exist_ok=True)
|
8 |
|
@@ -10,7 +10,7 @@ def download_and_extract_videos(dataset_name, output_dir, split):
|
|
10 |
# print(f"Downloading {zip_filename} from the dataset...")
|
11 |
zip_path = hf_hub_download(
|
12 |
repo_id=dataset_name,
|
13 |
-
filename=f"data/videos_{
|
14 |
repo_type="dataset",
|
15 |
local_dir=output_dir,
|
16 |
)
|
@@ -28,12 +28,9 @@ def download_and_extract_videos(dataset_name, output_dir, split):
|
|
28 |
|
29 |
print(f"Videos extracted to {output_dir}")
|
30 |
|
31 |
-
# Optional: Remove the downloaded zip file
|
32 |
-
# os.remove(zip_path)
|
33 |
-
|
34 |
# Usage
|
35 |
-
dataset_name = "viddiff/
|
36 |
output_dir = "."
|
37 |
-
|
38 |
-
for
|
39 |
-
download_and_extract_videos(dataset_name, output_dir,
|
|
|
2 |
import zipfile
|
3 |
import os
|
4 |
|
5 |
+
def download_and_extract_videos(dataset_name, output_dir, domain):
|
6 |
# Create output directory if it doesn't exist
|
7 |
os.makedirs(output_dir, exist_ok=True)
|
8 |
|
|
|
10 |
# print(f"Downloading {zip_filename} from the dataset...")
|
11 |
zip_path = hf_hub_download(
|
12 |
repo_id=dataset_name,
|
13 |
+
filename=f"data/videos_{domain}.zip",
|
14 |
repo_type="dataset",
|
15 |
local_dir=output_dir,
|
16 |
)
|
|
|
28 |
|
29 |
print(f"Videos extracted to {output_dir}")
|
30 |
|
|
|
|
|
|
|
31 |
# Usage
|
32 |
+
dataset_name = "viddiff/viddiff"
|
33 |
output_dir = "."
|
34 |
+
domains = ("surgery", "fitness")
|
35 |
+
for domain in domains:
|
36 |
+
download_and_extract_videos(dataset_name, output_dir, domain)
|