Update app.py
Browse files
app.py
CHANGED
|
@@ -470,20 +470,20 @@ class SabonzoAgent:
|
|
| 470 |
logging.info(f"Q{q_num_str}: Attempting GAIA file download from: {file_url}")
|
| 471 |
file_path = download_file(file_url, self.temp_dir, task_id) # Use standard download
|
| 472 |
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
|
| 488 |
# Update context and potentially final_answer based on analysis outcome
|
| 489 |
if analysis_result is not None:
|
|
|
|
| 470 |
logging.info(f"Q{q_num_str}: Attempting GAIA file download from: {file_url}")
|
| 471 |
file_path = download_file(file_url, self.temp_dir, task_id) # Use standard download
|
| 472 |
|
| 473 |
+
if not file_path: # Download failed or file is empty
|
| 474 |
+
analysis_result = f"ERROR: Failed download/access required GAIA file for Q{q_num_str} from {file_url}."
|
| 475 |
+
else: # Download succeeded, perform analysis
|
| 476 |
+
logging.info(f"Q{q_num_str}: GAIA File downloaded to {file_path}. Analyzing...")
|
| 477 |
+
try:
|
| 478 |
+
# Route to appropriate analysis function based on q_num_str
|
| 479 |
+
if q_num_str in IMAGE_TASKS: analysis_result = analyze_chess_image_gpt4o(file_path)
|
| 480 |
+
elif q_num_str in AUDIO_TASKS: analysis_result = process_downloaded_audio(file_path, q_num_str, self.llm) # Use standard audio processor
|
| 481 |
+
elif q_num_str in PYTHON_TASKS: analysis_result = run_python_script(file_path)
|
| 482 |
+
elif q_num_str in EXCEL_TASKS: analysis_result = analyze_excel(file_path, question)
|
| 483 |
+
else: analysis_result = f"ERROR: Internal routing error Q{q_num_str}."
|
| 484 |
+
except Exception as analysis_err:
|
| 485 |
+
logging.error(f"Analysis error Q{q_num_str}: {analysis_err}", exc_info=True)
|
| 486 |
+
analysis_result = f"ERROR: Unexpected analysis failure: {str(analysis_err)}"
|
| 487 |
|
| 488 |
# Update context and potentially final_answer based on analysis outcome
|
| 489 |
if analysis_result is not None:
|