sanjeed5 commited on
Commit
b94f3d0
·
1 Parent(s): 15e92df

Update file download logic in app.py to use task_id for constructing download URLs, while enhancing logging to include associated file names.

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -88,10 +88,10 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
88
 
89
  if file_name:
90
  # Construct download URL and local file path
91
- # Assuming files are served from a /files/ endpoint on the API server
92
- download_url = f"{api_url}/files/{file_name}"
93
  local_file_path = os.path.join(DOWNLOAD_DIR, file_name)
94
- print(f"Attempting to download file for task {task_id}: {file_name} from {download_url}")
95
  try:
96
  file_response = requests.get(download_url, stream=True, timeout=30)
97
  file_response.raise_for_status()
 
88
 
89
  if file_name:
90
  # Construct download URL and local file path
91
+ # File is identified by task_id on the server, but saved locally with its original file_name
92
+ download_url = f"{api_url}/files/{task_id}" # Changed from file_name to task_id
93
  local_file_path = os.path.join(DOWNLOAD_DIR, file_name)
94
+ print(f"Attempting to download file for task {task_id} (associated file name: {file_name}) from {download_url}")
95
  try:
96
  file_response = requests.get(download_url, stream=True, timeout=30)
97
  file_response.raise_for_status()