yhzhang3 commited on
Commit
c749d61
Β·
1 Parent(s): 13d2477

first commit

Browse files
Files changed (1) hide show
  1. app.py +20 -11
app.py CHANGED
@@ -198,24 +198,33 @@ Please be patient β€” takes about 20–30 minutes to process.
198
  ui_logs.append("βœ… Pipeline completed successfully!")
199
  ui_logs.append("="*70)
200
 
201
- # Look for output zip file in Results folder
202
  zip_file = None
203
 
204
- ui_logs.append("\nπŸ” Searching for output zip file in Results folder...")
205
 
206
  if results_path.exists():
207
- # Find all zip files and get the most recent one
208
- zip_files = list(results_path.rglob("*.zip"))
209
-
210
- if zip_files:
211
- # Sort by modification time, get the newest
212
- zip_file = str(max(zip_files, key=lambda p: p.stat().st_mtime))
213
- ui_logs.append(f"πŸ“¦ Found output file: {zip_file}")
 
 
 
 
 
 
 
 
 
214
  ui_logs.append(f"πŸ“₯ Ready for download!")
215
  ui_logs.append(f"\nπŸ“ Full logs saved to: {log_file_path}")
216
  yield "\n".join(ui_logs), zip_file, ""
217
- else:
218
- ui_logs.append("⚠️ No zip files found in Results folder")
219
  yield "\n".join(ui_logs), None, ""
220
  else:
221
  ui_logs.append(f"⚠️ Results folder not found at: {results_path}")
 
198
  ui_logs.append("βœ… Pipeline completed successfully!")
199
  ui_logs.append("="*70)
200
 
201
+ # Create zip file from Results folder
202
  zip_file = None
203
 
204
+ ui_logs.append("\nπŸ“¦ Creating zip archive from Results folder...")
205
 
206
  if results_path.exists():
207
+ import shutil
208
+
209
+ # Create zip file with timestamp
210
+ zip_base_name = f"Results_{timestamp}"
211
+ zip_file_path = ROOT / zip_base_name
212
+
213
+ try:
214
+ # Create zip archive of the entire Results folder
215
+ shutil.make_archive(
216
+ str(zip_file_path),
217
+ 'zip',
218
+ ROOT,
219
+ 'Results'
220
+ )
221
+ zip_file = str(zip_file_path) + ".zip"
222
+ ui_logs.append(f"βœ… Created zip file: {zip_file}")
223
  ui_logs.append(f"πŸ“₯ Ready for download!")
224
  ui_logs.append(f"\nπŸ“ Full logs saved to: {log_file_path}")
225
  yield "\n".join(ui_logs), zip_file, ""
226
+ except Exception as e:
227
+ ui_logs.append(f"⚠️ Failed to create zip file: {str(e)}")
228
  yield "\n".join(ui_logs), None, ""
229
  else:
230
  ui_logs.append(f"⚠️ Results folder not found at: {results_path}")