Merge branch 'main' of https://huggingface.co/datasets/mickylan2367/spectrogram_musicCaps
Browse files- README.md +2 -0
- spectrogram_musicCaps.py +10 -3
README.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
* .pyファイルでロードスクリプトを作ろうとしたけど、やり方が分からなくて失敗しているリポジトリです(;´∀`)
|
| 2 |
+
* とりあえず今は放置してあります
|
spectrogram_musicCaps.py
CHANGED
|
@@ -96,12 +96,19 @@ class spectrogram_musicCaps(datasets.GeneratorBasedBuilder):
|
|
| 96 |
with open(metadata_path, encoding="utf-8") as f:
|
| 97 |
# テキストファイルの方を入れる..
|
| 98 |
captions = f.readlines()
|
| 99 |
-
|
| 100 |
-
|
| 101 |
yield file_path,{
|
| 102 |
-
"image":
|
| 103 |
"caption":captions[idx]
|
| 104 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
# if file_path.startswith(_IMAGES_DIR): #
|
| 106 |
# if file_path[len(_IMAGES_DIR) : -len("*.png")] in files_to_keep:
|
| 107 |
# # label = file_path.split("/")[2]
|
|
|
|
| 96 |
with open(metadata_path, encoding="utf-8") as f:
|
| 97 |
# テキストファイルの方を入れる..
|
| 98 |
captions = f.readlines()
|
| 99 |
+
|
| 100 |
+
for idx, (file_path, file_obj) in enumerate(images):
|
| 101 |
yield file_path,{
|
| 102 |
+
"image": file_obj.read()
|
| 103 |
"caption":captions[idx]
|
| 104 |
}
|
| 105 |
+
|
| 106 |
+
# こんなもん..?
|
| 107 |
+
# for idx, (file_path, file_obj) in enumerate(images):
|
| 108 |
+
# yield file_path,{
|
| 109 |
+
# "image":{"path":file_path, "bytes":file_obj.read()},
|
| 110 |
+
# "caption":captions[idx]
|
| 111 |
+
# }
|
| 112 |
# if file_path.startswith(_IMAGES_DIR): #
|
| 113 |
# if file_path[len(_IMAGES_DIR) : -len("*.png")] in files_to_keep:
|
| 114 |
# # label = file_path.split("/")[2]
|