Spaces:
Sleeping
Sleeping
jaifar530
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -101,7 +101,79 @@ for filename, url in file_urls.items():
|
|
101 |
st.write(f"File {filename} already exists. Skipping download.")
|
102 |
############ download ridge and ExtraTree stuff
|
103 |
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
############### Load CNN Model ############
|
107 |
# Load the saved model
|
|
|
101 |
st.write(f"File {filename} already exists. Skipping download.")
|
102 |
############ download ridge and ExtraTree stuff
|
103 |
|
104 |
+
file_names = [
|
105 |
+
"truncated_260_to_284.xlsx_vectorizer.pkl",
|
106 |
+
"not_trancated_full_paragraph.xlsx_extra_trees_model.pkl",
|
107 |
+
"not_trancated_full_paragraph.xlsx_ridge_model.pkl",
|
108 |
+
"not_trancated_full_paragraph.xlsx_vectorizer.pkl",
|
109 |
+
"truncated_10_to_34.xlsx_extra_trees_model.pkl",
|
110 |
+
"truncated_10_to_34.xlsx_ridge_model.pkl",
|
111 |
+
"truncated_10_to_34.xlsx_vectorizer.pkl",
|
112 |
+
"truncated_35_to_59.xlsx_extra_trees_model.pkl",
|
113 |
+
"truncated_35_to_59.xlsx_ridge_model.pkl",
|
114 |
+
"truncated_35_to_59.xlsx_vectorizer.pkl",
|
115 |
+
"truncated_60_to_84.xlsx_extra_trees_model.pkl",
|
116 |
+
"truncated_60_to_84.xlsx_ridge_model.pkl",
|
117 |
+
"truncated_60_to_84.xlsx_vectorizer.pkl",
|
118 |
+
"truncated_85_to_109.xlsx_extra_trees_model.pkl",
|
119 |
+
"truncated_85_to_109.xlsx_ridge_model.pkl",
|
120 |
+
"truncated_85_to_109.xlsx_vectorizer.pkl",
|
121 |
+
"truncated_110_to_134.xlsx_extra_trees_model.pkl",
|
122 |
+
"truncated_110_to_134.xlsx_ridge_model.pkl",
|
123 |
+
"truncated_110_to_134.xlsx_vectorizer.pkl",
|
124 |
+
"truncated_135_to_159.xlsx_extra_trees_model.pkl",
|
125 |
+
"truncated_135_to_159.xlsx_ridge_model.pkl",
|
126 |
+
"truncated_135_to_159.xlsx_vectorizer.pkl",
|
127 |
+
"truncated_160_to_184.xlsx_extra_trees_model.pkl",
|
128 |
+
"truncated_160_to_184.xlsx_ridge_model.pkl",
|
129 |
+
"truncated_160_to_184.xlsx_vectorizer.pkl",
|
130 |
+
"truncated_185_to_209.xlsx_extra_trees_model.pkl",
|
131 |
+
"truncated_185_to_209.xlsx_ridge_model.pkl",
|
132 |
+
"truncated_185_to_209.xlsx_vectorizer.pkl",
|
133 |
+
"truncated_210_to_234.xlsx_extra_trees_model.pkl",
|
134 |
+
"truncated_210_to_234.xlsx_ridge_model.pkl",
|
135 |
+
"truncated_210_to_234.xlsx_vectorizer.pkl",
|
136 |
+
"truncated_235_to_259.xlsx_extra_trees_model.pkl",
|
137 |
+
"truncated_235_to_259.xlsx_ridge_model.pkl",
|
138 |
+
"truncated_235_to_259.xlsx_vectorizer.pkl",
|
139 |
+
"truncated_260_to_284.xlsx_extra_trees_model.pkl",
|
140 |
+
"truncated_260_to_284.xlsx_ridge_model.pkl"
|
141 |
+
]
|
142 |
+
|
143 |
+
def check_and_download_files():
|
144 |
+
missing_files = []
|
145 |
+
for file_name in file_names:
|
146 |
+
if not os.path.exists(file_name):
|
147 |
+
missing_files.append(file_name)
|
148 |
+
|
149 |
+
if missing_files:
|
150 |
+
print("The following files are missing:")
|
151 |
+
for file_name in missing_files:
|
152 |
+
print(file_name)
|
153 |
+
|
154 |
+
try:
|
155 |
+
headers = {
|
156 |
+
'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',
|
157 |
+
}
|
158 |
+
url = 'https://jaifar.net/ADS/content.zip' # Replace with the actual URL
|
159 |
+
|
160 |
+
response = requests.get(url, headers=headers)
|
161 |
+
response.raise_for_status()
|
162 |
+
|
163 |
+
with open('content.zip', 'wb') as zip_file:
|
164 |
+
zip_file.write(response.content)
|
165 |
+
|
166 |
+
with zipfile.ZipFile('content.zip', 'r') as zip_ref:
|
167 |
+
zip_ref.extractall()
|
168 |
+
|
169 |
+
print("content.zip downloaded and extracted successfully.")
|
170 |
+
except Exception as e:
|
171 |
+
print(f"Error downloading or extracting content.zip: {e}")
|
172 |
+
else:
|
173 |
+
print("All files exist.")
|
174 |
+
|
175 |
+
|
176 |
+
check_and_download_files()
|
177 |
|
178 |
############### Load CNN Model ############
|
179 |
# Load the saved model
|