gabejavitt commited on
Commit
cb2038e
·
verified ·
1 Parent(s): 14bbd92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1535,7 +1535,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
1535
  # Initialize file variables for the current question
1536
  # Try to download file for EVERY task (not just if file_path exists)
1537
  file_download_url = f"{DEFAULT_API_URL}/files/{task_id}"
1538
- local_file_path = f"{task_id}.tmp" # or detect extension
1539
 
1540
  try:
1541
  file_response = requests.get(file_download_url, timeout=15)
@@ -1577,7 +1577,12 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
1577
  abs_path = os.path.abspath(local_file_path)
1578
 
1579
  print(f"✅ Downloaded: {filename} ({file_size} bytes)")
1580
- print(f" Saved to: {abs_path}")
 
 
 
 
 
1581
  except Exception as e:
1582
  # Handles any other unexpected errors
1583
  print(f"\n❌ An unexpected error occurred: {e}")
 
1535
  # Initialize file variables for the current question
1536
  # Try to download file for EVERY task (not just if file_path exists)
1537
  file_download_url = f"{DEFAULT_API_URL}/files/{task_id}"
1538
+ local_file_path = None
1539
 
1540
  try:
1541
  file_response = requests.get(file_download_url, timeout=15)
 
1577
  abs_path = os.path.abspath(local_file_path)
1578
 
1579
  print(f"✅ Downloaded: {filename} ({file_size} bytes)")
1580
+ print(f" Saved to: {abs_path}")
1581
+ elif file_response.status_code == 404:
1582
+ print(f"ℹ️ No file found for task {task_id} (404), proceeding without file.")
1583
+ else:
1584
+ print(f"⚠️ Warning: File download for {task_id} failed with status {file_response.status_code}")
1585
+
1586
  except Exception as e:
1587
  # Handles any other unexpected errors
1588
  print(f"\n❌ An unexpected error occurred: {e}")