Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -175,22 +175,21 @@ class FileProcessor:
|
|
175 |
for file in files:
|
176 |
# Check if the file is a Gradio File object or a string path
|
177 |
file_name = file.name if isinstance(file, gr.File) else file
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
continue # Skip this file
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
else:
|
187 |
-
combined_data.extend(self._process_single_file(file_name))
|
188 |
else:
|
189 |
-
|
190 |
|
191 |
except Exception as e:
|
192 |
logger.error(f"Error processing files: {str(e)}")
|
193 |
return []
|
|
|
|
|
194 |
|
195 |
def _process_zip_file(self, zip_path: str) -> List[Dict]:
|
196 |
"""Process ZIP file contents"""
|
|
|
175 |
for file in files:
|
176 |
# Check if the file is a Gradio File object or a string path
|
177 |
file_name = file.name if isinstance(file, gr.File) else file
|
178 |
+
file_size = os.path.getsize(file_name)
|
179 |
+
if file_size > self.max_file_size:
|
180 |
+
logger.warning(f"File size ({file_size} bytes) exceeds maximum allowed size")
|
181 |
+
continue # Skip this file
|
|
|
182 |
|
183 |
+
if zipfile.is_zipfile(file_name):
|
184 |
+
combined_data.extend(self._process_zip_file(file_name))
|
|
|
|
|
185 |
else:
|
186 |
+
combined_data.extend(self._process_single_file(file_name))
|
187 |
|
188 |
except Exception as e:
|
189 |
logger.error(f"Error processing files: {str(e)}")
|
190 |
return []
|
191 |
+
finally:
|
192 |
+
return combined_data
|
193 |
|
194 |
def _process_zip_file(self, zip_path: str) -> List[Dict]:
|
195 |
"""Process ZIP file contents"""
|