Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1462,7 +1462,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 1462 |
original_filename = file_path_from_api.split('/')[-1]
|
| 1463 |
|
| 1464 |
# Set the path where the file will be saved locally
|
| 1465 |
-
local_file_path =
|
| 1466 |
|
| 1467 |
print(f"📥 Downloading file for task {task_id}...")
|
| 1468 |
print(f" URL: {file_download_url}")
|
|
@@ -1472,17 +1472,18 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 1472 |
file_response = requests.get(file_download_url, timeout=15)
|
| 1473 |
file_response.raise_for_status()
|
| 1474 |
|
| 1475 |
-
# Save the raw bytes content to the local file path
|
| 1476 |
with open(local_file_path, 'wb') as f:
|
| 1477 |
f.write(file_response.content)
|
| 1478 |
|
| 1479 |
file_size = os.path.getsize(local_file_path)
|
| 1480 |
print(f"✅ Downloaded file: {original_filename} ({file_size} bytes)")
|
| 1481 |
|
| 1482 |
-
#
|
| 1483 |
if not os.path.exists(local_file_path):
|
| 1484 |
print(f"⚠️ Warning: File saved but cannot be found at {local_file_path}")
|
| 1485 |
local_file_path = None
|
|
|
|
|
|
|
| 1486 |
|
| 1487 |
except requests.exceptions.RequestException as e:
|
| 1488 |
error_message = f"[FILE DOWNLOAD ERROR: Could not fetch file: {e}]"
|
|
|
|
| 1462 |
original_filename = file_path_from_api.split('/')[-1]
|
| 1463 |
|
| 1464 |
# Set the path where the file will be saved locally
|
| 1465 |
+
local_file_path = original_filename
|
| 1466 |
|
| 1467 |
print(f"📥 Downloading file for task {task_id}...")
|
| 1468 |
print(f" URL: {file_download_url}")
|
|
|
|
| 1472 |
file_response = requests.get(file_download_url, timeout=15)
|
| 1473 |
file_response.raise_for_status()
|
| 1474 |
|
|
|
|
| 1475 |
with open(local_file_path, 'wb') as f:
|
| 1476 |
f.write(file_response.content)
|
| 1477 |
|
| 1478 |
file_size = os.path.getsize(local_file_path)
|
| 1479 |
print(f"✅ Downloaded file: {original_filename} ({file_size} bytes)")
|
| 1480 |
|
| 1481 |
+
# Add verification
|
| 1482 |
if not os.path.exists(local_file_path):
|
| 1483 |
print(f"⚠️ Warning: File saved but cannot be found at {local_file_path}")
|
| 1484 |
local_file_path = None
|
| 1485 |
+
else:
|
| 1486 |
+
print(f"✓ File accessible at: {os.path.abspath(local_file_path)}") # Debug line
|
| 1487 |
|
| 1488 |
except requests.exceptions.RequestException as e:
|
| 1489 |
error_message = f"[FILE DOWNLOAD ERROR: Could not fetch file: {e}]"
|