Datasets:
Size:
10K<n<100K
License:
MuGeminorum
commited on
Commit
•
6244213
1
Parent(s):
4bbafbb
integrate cdn url into class
Browse files- music_genre.py +9 -13
music_genre.py
CHANGED
@@ -59,18 +59,6 @@ with lengths of 270-300s that are divided into 17 genres in total.
|
|
59 |
"""
|
60 |
|
61 |
|
62 |
-
def _cdn_url(ip='10.115.8.4', port=80):
|
63 |
-
try:
|
64 |
-
# create a socket connection
|
65 |
-
with socket.create_connection((ip, port), timeout=5):
|
66 |
-
return f'http://{ip}/{_NAME}/data/data.zip'
|
67 |
-
except (socket.timeout, socket.error):
|
68 |
-
return f"{_HOMEPAGE}/resolve/main/data/data.zip"
|
69 |
-
|
70 |
-
|
71 |
-
_URL = _cdn_url()
|
72 |
-
|
73 |
-
|
74 |
class music_genre(datasets.GeneratorBasedBuilder):
|
75 |
def _info(self):
|
76 |
return datasets.DatasetInfo(
|
@@ -98,8 +86,16 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
98 |
]
|
99 |
)
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
def _split_generators(self, dl_manager):
|
102 |
-
data_files = dl_manager.download_and_extract(
|
103 |
files = dl_manager.iter_files([data_files])
|
104 |
|
105 |
dataset = []
|
|
|
59 |
"""
|
60 |
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
class music_genre(datasets.GeneratorBasedBuilder):
|
63 |
def _info(self):
|
64 |
return datasets.DatasetInfo(
|
|
|
86 |
]
|
87 |
)
|
88 |
|
89 |
+
def _cdn_url(self, ip='127.0.0.1', port=80):
|
90 |
+
try:
|
91 |
+
# easy for local test
|
92 |
+
with socket.create_connection((ip, port), timeout=5):
|
93 |
+
return f'http://{ip}/{_NAME}/data/data.zip'
|
94 |
+
except (socket.timeout, socket.error):
|
95 |
+
return f"{_HOMEPAGE}/resolve/main/data/data.zip"
|
96 |
+
|
97 |
def _split_generators(self, dl_manager):
|
98 |
+
data_files = dl_manager.download_and_extract(self._cdn_url())
|
99 |
files = dl_manager.iter_files([data_files])
|
100 |
|
101 |
dataset = []
|