Spaces:
No application file
No application file
Update system_stats.py
Browse files- system_stats.py +22 -0
system_stats.py
CHANGED
|
@@ -31,4 +31,26 @@ def get_stats(file_path):
|
|
| 31 |
|
| 32 |
# Save the DataFrame to a CSV file
|
| 33 |
data.to_csv(file_path, index=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
|
|
|
| 31 |
|
| 32 |
# Save the DataFrame to a CSV file
|
| 33 |
data.to_csv(file_path, index=False)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
file_list = ['doc/page_1.txt', 'doc/page_1.txt', 'doc/page_2.table', 'doc/page3_img.table', 'doc/page3_img2.table', 'doc/page3_img3.table']
|
| 38 |
+
|
| 39 |
+
page_dict = {}
|
| 40 |
+
|
| 41 |
+
for file_path in file_list:
|
| 42 |
+
# Extracting page number from the file name
|
| 43 |
+
page_number = file_path.split('/')[-1].split('_')[1].split('.')[0]
|
| 44 |
+
|
| 45 |
+
# Checking if the file is a text file
|
| 46 |
+
if file_path.endswith('.txt'):
|
| 47 |
+
# Opening the text file and reading its content
|
| 48 |
+
with open(file_path, 'r') as file:
|
| 49 |
+
content = file.read()
|
| 50 |
+
|
| 51 |
+
# Adding the content to the dictionary with page number as key
|
| 52 |
+
page_dict[page_number] = content
|
| 53 |
+
|
| 54 |
+
print(page_dict)
|
| 55 |
+
|
| 56 |
|