Spaces:
Sleeping
Sleeping
GAIA Developer
Claude
commited on
Commit
·
4656896
1
Parent(s):
520f8ca
🔧 Fix root app.py with proper imports and answer extraction
Browse filesApplied the same critical fixes to the root app.py that the Hugging Face Space
is actually using:
- Added proper Python path setup for module imports
- Removed redundant answer extraction that was corrupting processed results
- This should restore accuracy from 20% back to expected 90% level
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -5,6 +5,7 @@ High-performance GAIA solver with 90% accuracy integrated into a clean submissio
|
|
| 5 |
"""
|
| 6 |
|
| 7 |
import os
|
|
|
|
| 8 |
import gradio as gr
|
| 9 |
import requests
|
| 10 |
import pandas as pd
|
|
@@ -14,6 +15,10 @@ import time
|
|
| 14 |
from datetime import datetime
|
| 15 |
from pathlib import Path
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# --- Constants ---
|
| 18 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 19 |
|
|
@@ -92,21 +97,19 @@ class AdvancedGAIAAgent:
|
|
| 92 |
"question": question,
|
| 93 |
"file_name": ""
|
| 94 |
}
|
| 95 |
-
|
| 96 |
-
answer = self.
|
| 97 |
elif self.solver == "refactored":
|
| 98 |
# For refactored architecture
|
| 99 |
try:
|
| 100 |
from main_refactored import main as refactored_main
|
| 101 |
-
|
| 102 |
-
answer = self._extract_answer(result)
|
| 103 |
except Exception as e:
|
| 104 |
print(f"Refactored solver error: {e}")
|
| 105 |
answer = f"Refactored solver error: {e}"
|
| 106 |
elif hasattr(self.solver, '__call__'):
|
| 107 |
# Generic callable solver
|
| 108 |
-
|
| 109 |
-
answer = self._extract_answer(result)
|
| 110 |
else:
|
| 111 |
# Last resort
|
| 112 |
answer = "Unable to process question with current solver"
|
|
|
|
| 5 |
"""
|
| 6 |
|
| 7 |
import os
|
| 8 |
+
import sys
|
| 9 |
import gradio as gr
|
| 10 |
import requests
|
| 11 |
import pandas as pd
|
|
|
|
| 15 |
from datetime import datetime
|
| 16 |
from pathlib import Path
|
| 17 |
|
| 18 |
+
# Add current directory to Python path to find main modules
|
| 19 |
+
sys.path.insert(0, '/home/user/app')
|
| 20 |
+
sys.path.insert(0, '/home/user')
|
| 21 |
+
|
| 22 |
# --- Constants ---
|
| 23 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 24 |
|
|
|
|
| 97 |
"question": question,
|
| 98 |
"file_name": ""
|
| 99 |
}
|
| 100 |
+
# solve_question already returns a clean, processed answer string
|
| 101 |
+
answer = self.solver.solve_question(question_data)
|
| 102 |
elif self.solver == "refactored":
|
| 103 |
# For refactored architecture
|
| 104 |
try:
|
| 105 |
from main_refactored import main as refactored_main
|
| 106 |
+
answer = refactored_main(question)
|
|
|
|
| 107 |
except Exception as e:
|
| 108 |
print(f"Refactored solver error: {e}")
|
| 109 |
answer = f"Refactored solver error: {e}"
|
| 110 |
elif hasattr(self.solver, '__call__'):
|
| 111 |
# Generic callable solver
|
| 112 |
+
answer = self.solver(question)
|
|
|
|
| 113 |
else:
|
| 114 |
# Last resort
|
| 115 |
answer = "Unable to process question with current solver"
|