Spaces:
Running
Running
jaifar530
commited on
Update file_checker.py
Browse files- file_checker.py +45 -2
file_checker.py
CHANGED
@@ -2,7 +2,47 @@ import os
|
|
2 |
import requests
|
3 |
import zipfile
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
missing_files = []
|
7 |
for file_name in file_names:
|
8 |
if not os.path.exists(file_name):
|
@@ -17,7 +57,7 @@ def check_and_download_files(file_names):
|
|
17 |
headers = {
|
18 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
19 |
}
|
20 |
-
url = '
|
21 |
|
22 |
response = requests.get(url, headers=headers)
|
23 |
response.raise_for_status()
|
@@ -33,3 +73,6 @@ def check_and_download_files(file_names):
|
|
33 |
print(f"Error downloading or extracting content.zip: {e}")
|
34 |
else:
|
35 |
print("All files exist.")
|
|
|
|
|
|
|
|
2 |
import requests
|
3 |
import zipfile
|
4 |
|
5 |
+
# List of file names without paths
|
6 |
+
file_names = [
|
7 |
+
"truncated_260_to_284.xlsx_vectorizer.pkl",
|
8 |
+
"not_trancated_full_paragraph.xlsx_extra_trees_model.pkl",
|
9 |
+
"not_trancated_full_paragraph.xlsx_ridge_model.pkl",
|
10 |
+
"not_trancated_full_paragraph.xlsx_vectorizer.pkl",
|
11 |
+
"truncated_10_to_34.xlsx_extra_trees_model.pkl",
|
12 |
+
"truncated_10_to_34.xlsx_ridge_model.pkl",
|
13 |
+
"truncated_10_to_34.xlsx_vectorizer.pkl",
|
14 |
+
"truncated_35_to_59.xlsx_extra_trees_model.pkl",
|
15 |
+
"truncated_35_to_59.xlsx_ridge_model.pkl",
|
16 |
+
"truncated_35_to_59.xlsx_vectorizer.pkl",
|
17 |
+
"truncated_60_to_84.xlsx_extra_trees_model.pkl",
|
18 |
+
"truncated_60_to_84.xlsx_ridge_model.pkl",
|
19 |
+
"truncated_60_to_84.xlsx_vectorizer.pkl",
|
20 |
+
"truncated_85_to_109.xlsx_extra_trees_model.pkl",
|
21 |
+
"truncated_85_to_109.xlsx_ridge_model.pkl",
|
22 |
+
"truncated_85_to_109.xlsx_vectorizer.pkl",
|
23 |
+
"truncated_110_to_134.xlsx_extra_trees_model.pkl",
|
24 |
+
"truncated_110_to_134.xlsx_ridge_model.pkl",
|
25 |
+
"truncated_110_to_134.xlsx_vectorizer.pkl",
|
26 |
+
"truncated_135_to_159.xlsx_extra_trees_model.pkl",
|
27 |
+
"truncated_135_to_159.xlsx_ridge_model.pkl",
|
28 |
+
"truncated_135_to_159.xlsx_vectorizer.pkl",
|
29 |
+
"truncated_160_to_184.xlsx_extra_trees_model.pkl",
|
30 |
+
"truncated_160_to_184.xlsx_ridge_model.pkl",
|
31 |
+
"truncated_160_to_184.xlsx_vectorizer.pkl",
|
32 |
+
"truncated_185_to_209.xlsx_extra_trees_model.pkl",
|
33 |
+
"truncated_185_to_209.xlsx_ridge_model.pkl",
|
34 |
+
"truncated_185_to_209.xlsx_vectorizer.pkl",
|
35 |
+
"truncated_210_to_234.xlsx_extra_trees_model.pkl",
|
36 |
+
"truncated_210_to_234.xlsx_ridge_model.pkl",
|
37 |
+
"truncated_210_to_234.xlsx_vectorizer.pkl",
|
38 |
+
"truncated_235_to_259.xlsx_extra_trees_model.pkl",
|
39 |
+
"truncated_235_to_259.xlsx_ridge_model.pkl",
|
40 |
+
"truncated_235_to_259.xlsx_vectorizer.pkl",
|
41 |
+
"truncated_260_to_284.xlsx_extra_trees_model.pkl",
|
42 |
+
"truncated_260_to_284.xlsx_ridge_model.pkl"
|
43 |
+
]
|
44 |
+
|
45 |
+
def check_and_download_files():
|
46 |
missing_files = []
|
47 |
for file_name in file_names:
|
48 |
if not os.path.exists(file_name):
|
|
|
57 |
headers = {
|
58 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
59 |
}
|
60 |
+
url = 'URL_TO_DOWNLOAD_CONTENT.ZIP' # Replace with the actual URL
|
61 |
|
62 |
response = requests.get(url, headers=headers)
|
63 |
response.raise_for_status()
|
|
|
73 |
print(f"Error downloading or extracting content.zip: {e}")
|
74 |
else:
|
75 |
print("All files exist.")
|
76 |
+
|
77 |
+
# Uncomment the line below if you want the check_and_download_files function to run when this module is executed directly.
|
78 |
+
# check_and_download_files()
|