Add files using upload-large-folder tool
Browse files- CreateDataset.py +10 -5
- metadata.csv +31 -0
- metadata.parquet +3 -0
CreateDataset.py
CHANGED
|
@@ -23,12 +23,12 @@ def clean_name(name: str) -> str:
|
|
| 23 |
|
| 24 |
|
| 25 |
class MemeRecord(BaseModel):
|
| 26 |
-
|
| 27 |
type: Literal["image", "video"]
|
| 28 |
category: str
|
| 29 |
caption: str = ""
|
| 30 |
|
| 31 |
-
@field_validator("
|
| 32 |
@classmethod
|
| 33 |
def normalize_path(cls, v: str) -> str:
|
| 34 |
return v.replace("\\", "/")
|
|
@@ -67,18 +67,23 @@ def main(root: Path):
|
|
| 67 |
|
| 68 |
records.append(
|
| 69 |
MemeRecord(
|
| 70 |
-
|
| 71 |
type=media_type,
|
| 72 |
category=category,
|
| 73 |
caption=""
|
| 74 |
)
|
| 75 |
)
|
| 76 |
|
|
|
|
|
|
|
|
|
|
| 77 |
df = pd.DataFrame([r.model_dump() for r in records])
|
|
|
|
|
|
|
| 78 |
df.to_csv(root / "metadata.csv", index=False)
|
| 79 |
-
|
| 80 |
|
| 81 |
-
print(f"✔ Indexed {len(df)} files (
|
| 82 |
|
| 83 |
|
| 84 |
if __name__ == "__main__":
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
class MemeRecord(BaseModel):
|
| 26 |
+
file_name: str # ✅ HF-required
|
| 27 |
type: Literal["image", "video"]
|
| 28 |
category: str
|
| 29 |
caption: str = ""
|
| 30 |
|
| 31 |
+
@field_validator("file_name")
|
| 32 |
@classmethod
|
| 33 |
def normalize_path(cls, v: str) -> str:
|
| 34 |
return v.replace("\\", "/")
|
|
|
|
| 67 |
|
| 68 |
records.append(
|
| 69 |
MemeRecord(
|
| 70 |
+
file_name=str(path.relative_to(root)),
|
| 71 |
type=media_type,
|
| 72 |
category=category,
|
| 73 |
caption=""
|
| 74 |
)
|
| 75 |
)
|
| 76 |
|
| 77 |
+
if not records:
|
| 78 |
+
raise SystemExit("❌ No media files found")
|
| 79 |
+
|
| 80 |
df = pd.DataFrame([r.model_dump() for r in records])
|
| 81 |
+
|
| 82 |
+
# ✅ BOTH formats – HF folder builder expects CSV
|
| 83 |
df.to_csv(root / "metadata.csv", index=False)
|
| 84 |
+
df.to_parquet(root / "metadata.parquet", index=False)
|
| 85 |
|
| 86 |
+
print(f"✔ Indexed {len(df)} files (record-only)")
|
| 87 |
|
| 88 |
|
| 89 |
if __name__ == "__main__":
|
metadata.csv
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
file_name,type,category,caption
|
| 2 |
+
meme/Horror/Images/20251122_140807.jpg,image,Horror,
|
| 3 |
+
meme/Horror/Images/20251122_135659.jpg,image,Horror,
|
| 4 |
+
meme/Horror/Images/20251122_140759.jpg,image,Horror,
|
| 5 |
+
meme/Horror/Images/20251122_135701.jpg,image,Horror,
|
| 6 |
+
meme/Horror/Images/20251122_140811.jpg,image,Horror,
|
| 7 |
+
meme/Horror/Images/20251122_140823.jpg,image,Horror,
|
| 8 |
+
meme/Horror/Images/20251122_140820.jpg,image,Horror,
|
| 9 |
+
meme/Horror/Images/20251122_140815.jpg,image,Horror,
|
| 10 |
+
meme/Horror/Images/20251122_140821.jpg,image,Horror,
|
| 11 |
+
meme/Horror/Video/RDT_20251130_131417.mp4,video,Horror,
|
| 12 |
+
meme/Horror/Video/RDT_20251130_132057.mp4,video,Horror,
|
| 13 |
+
meme/PopCulture/Images/20251125_231541.jpg,image,PopCulture,
|
| 14 |
+
meme/PopCulture/Images/RDT_20251002_163421.mp4,video,PopCulture,
|
| 15 |
+
meme/PopCulture/Images/20251125_231646.jpg,image,PopCulture,
|
| 16 |
+
meme/PopCulture/Images/20251125_231609.jpg,image,PopCulture,
|
| 17 |
+
meme/PopCulture/Images/RDT_20250927_1657182428080882462356412.jpg,image,PopCulture,
|
| 18 |
+
meme/PopCulture/Images/20251125_231527.jpg,image,PopCulture,
|
| 19 |
+
meme/PopCulture/Images/20251215_224438.jpg,image,PopCulture,
|
| 20 |
+
meme/PopCulture/Images/20251125_231505.jpg,image,PopCulture,
|
| 21 |
+
meme/PopCulture/Images/RDT_20251130_0224192529849478901776577.jpg,image,PopCulture,
|
| 22 |
+
meme/PopCulture/Images/20251215_224427.jpg,image,PopCulture,
|
| 23 |
+
meme/PopCulture/Images/20251125_231532.jpg,image,PopCulture,
|
| 24 |
+
meme/PopCulture/Images/20251125_231454.jpg,image,PopCulture,
|
| 25 |
+
meme/PopCulture/Images/20251125_231614.jpg,image,PopCulture,
|
| 26 |
+
meme/PopCulture/Images/20251215_224431.jpg,image,PopCulture,
|
| 27 |
+
meme/PopCulture/Images/20251125_231555.jpg,image,PopCulture,
|
| 28 |
+
meme/Funny/Images/Meta_image_000001.jpg,image,Funny,
|
| 29 |
+
meme/Meta/Images/20251204_164344.jpg,image,Meta,
|
| 30 |
+
meme/History/Images/RDT_20250812_0322097964034324098857757.jpg,image,History,
|
| 31 |
+
meme/History/Images/20251205_110603.jpg,image,History,
|
metadata.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afb936eb96de847298c14c43d25ee635769722b4c082b9b07929162eb6fec811
|
| 3 |
+
size 3402
|