Varun Hemachandran commited on
Commit
8f99300
·
1 Parent(s): 2ad713c

Create simple dataset format for Hugging Face viewer

Browse files
create_simple_dataset.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import json
3
+ import os
4
+ import shutil
5
+ from tqdm import tqdm
6
+
7
+ # First, let's clean up our previous attempts
8
+ if os.path.exists('default'):
9
+ shutil.rmtree('default')
10
+ if os.path.exists('default-fixed'):
11
+ shutil.rmtree('default-fixed')
12
+
13
+ # Create a simple dataset with just 10 examples to test
14
+ os.makedirs('simple_dataset', exist_ok=True)
15
+
16
+ # Directory containing the PDF files
17
+ data_dir = "data"
18
+
19
+ # Get all PDF files (just the first 10 for testing)
20
+ pdf_files = sorted(os.listdir(data_dir))[:10]
21
+
22
+ # Create a simple metadata.jsonl file
23
+ with open('simple_dataset/metadata.jsonl', 'w') as f:
24
+ for pdf_file in tqdm(pdf_files, desc="Creating metadata"):
25
+ file_path = os.path.join(data_dir, pdf_file)
26
+ if os.path.isfile(file_path) and pdf_file.endswith('.pdf'):
27
+ file_size = os.path.getsize(file_path)
28
+
29
+ # Create a simple metadata entry
30
+ metadata = {
31
+ "file_name": pdf_file,
32
+ "file_path": file_path,
33
+ "file_size": file_size,
34
+ "content_type": "application/pdf"
35
+ }
36
+
37
+ f.write(json.dumps(metadata) + '\n')
38
+
39
+ # Create a simple README.md file for the dataset
40
+ with open('simple_dataset/README.md', 'w') as f:
41
+ f.write("""# JFK Document Collection Sample
42
+
43
+ This is a sample of the JFK Document Release 2025 collection. The full collection contains over 2,000 declassified documents related to the assassination of President John F. Kennedy.
44
+
45
+ ## Files
46
+
47
+ The documents are PDF files named according to the National Archives naming convention (e.g., `104-10003-10041.pdf`).
48
+
49
+ ## Usage
50
+
51
+ You can access the full collection at: https://huggingface.co/datasets/varunh/jfk-files-2025
52
+
53
+ For a more user-friendly interface, visit: https://huggingface.co/datasets/varunh/jfk-files-2025/blob/main/index.html
54
+ """)
55
+
56
+ print("Created simple dataset with 10 examples")
simple_dataset/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # JFK Document Collection Sample
2
+
3
+ This is a sample of the JFK Document Release 2025 collection. The full collection contains over 2,000 declassified documents related to the assassination of President John F. Kennedy.
4
+
5
+ ## Files
6
+
7
+ The documents are PDF files named according to the National Archives naming convention (e.g., `104-10003-10041.pdf`).
8
+
9
+ ## Usage
10
+
11
+ You can access the full collection at: https://huggingface.co/datasets/varunh/jfk-files-2025
12
+
13
+ For a more user-friendly interface, visit: https://huggingface.co/datasets/varunh/jfk-files-2025/blob/main/index.html
simple_dataset/metadata.jsonl ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {"file_name": "104-10003-10041.pdf", "file_path": "data/104-10003-10041.pdf", "file_size": 59643, "content_type": "application/pdf"}
2
+ {"file_name": "104-10004-10143 (C06932208).pdf", "file_path": "data/104-10004-10143 (C06932208).pdf", "file_size": 207960, "content_type": "application/pdf"}
3
+ {"file_name": "104-10004-10143.pdf", "file_path": "data/104-10004-10143.pdf", "file_size": 415346, "content_type": "application/pdf"}
4
+ {"file_name": "104-10004-10156.pdf", "file_path": "data/104-10004-10156.pdf", "file_size": 74016, "content_type": "application/pdf"}
5
+ {"file_name": "104-10004-10213.pdf", "file_path": "data/104-10004-10213.pdf", "file_size": 2295115, "content_type": "application/pdf"}
6
+ {"file_name": "104-10005-10321.pdf", "file_path": "data/104-10005-10321.pdf", "file_size": 915512, "content_type": "application/pdf"}
7
+ {"file_name": "104-10006-10247.pdf", "file_path": "data/104-10006-10247.pdf", "file_size": 298691, "content_type": "application/pdf"}
8
+ {"file_name": "104-10007-10345.pdf", "file_path": "data/104-10007-10345.pdf", "file_size": 378517, "content_type": "application/pdf"}
9
+ {"file_name": "104-10009-10021.pdf", "file_path": "data/104-10009-10021.pdf", "file_size": 141471, "content_type": "application/pdf"}
10
+ {"file_name": "104-10009-10222.pdf", "file_path": "data/104-10009-10222.pdf", "file_size": 45802, "content_type": "application/pdf"}