Datasets:
Tasks:
Audio Classification
Modalities:
Text
Formats:
webdataset
Size:
100K - 1M
ArXiv:
Tags:
Bioacoustics
License:
ilyassmoummad
commited on
Create download.py
Browse files- download.py +21 -0
download.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import hf_hub_download
|
2 |
+
import string
|
3 |
+
import os
|
4 |
+
|
5 |
+
REPO_NAME = "ilyassmoummad/Xeno-Canto-6s-16khz"
|
6 |
+
DESTINATION_PATH = "" # <- The path where you want to download the data
|
7 |
+
|
8 |
+
os.makedirs(DESTINATION_PATH, exist_ok=True)
|
9 |
+
|
10 |
+
base_file = "xc-6s-16khz-pann.tar."
|
11 |
+
|
12 |
+
tar_files = [f"{base_file}{ext}" for ext in (string.ascii_lowercase[i] + string.ascii_lowercase[j] for i in range(0, 1) for j in range(0, 13))]
|
13 |
+
|
14 |
+
for tar_file in tar_files:
|
15 |
+
try:
|
16 |
+
file_path = hf_hub_download(repo_id=REPO_NAME, filename=tar_file, repo_type="dataset")
|
17 |
+
dest_file_path = os.path.join(DESTINATION_PATH, os.path.basename(file_path))
|
18 |
+
os.rename(file_path, dest_file_path)
|
19 |
+
print(f"Downloaded {dest_file_path}")
|
20 |
+
except Exception as e:
|
21 |
+
print(f"Failed to download {tar_file}: {e}")
|