Spaces:
Sleeping
Sleeping
EtienneB
commited on
Commit
·
f255c6e
1
Parent(s):
70d4afb
updated
Browse files- __pycache__/tools.cpython-313.pyc +0 -0
- app.py +9 -2
__pycache__/tools.cpython-313.pyc
CHANGED
Binary files a/__pycache__/tools.cpython-313.pyc and b/__pycache__/tools.cpython-313.pyc differ
|
|
app.py
CHANGED
@@ -25,7 +25,10 @@ MAX_AGENT_ITERATIONS = 15
|
|
25 |
MAX_CONCURRENT_REQUESTS = 5 # Limit concurrent requests to avoid overwhelming the API
|
26 |
|
27 |
load_dotenv()
|
28 |
-
HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
|
|
|
|
|
|
29 |
|
30 |
# Global cache for answers
|
31 |
answer_cache = {}
|
@@ -269,7 +272,11 @@ def cache_answers(profile: gr.OAuthProfile | None):
|
|
269 |
print(f"Fetched {len(questions_data)} questions for caching.")
|
270 |
|
271 |
# Initialize agent
|
272 |
-
|
|
|
|
|
|
|
|
|
273 |
|
274 |
# Process questions
|
275 |
results_log, answers_payload = asyncio.run(run_agent_async_improved(agent, questions_data))
|
|
|
25 |
MAX_CONCURRENT_REQUESTS = 5 # Limit concurrent requests to avoid overwhelming the API
|
26 |
|
27 |
load_dotenv()
|
28 |
+
HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN") or os.getenv("HF_TOKEN")
|
29 |
+
|
30 |
+
# Quick test to see if tokens are available.
|
31 |
+
print(f"Available env vars: {[k for k in os.environ.keys() if 'TOKEN' in k or 'HF' in k]}")
|
32 |
|
33 |
# Global cache for answers
|
34 |
answer_cache = {}
|
|
|
272 |
print(f"Fetched {len(questions_data)} questions for caching.")
|
273 |
|
274 |
# Initialize agent
|
275 |
+
try:
|
276 |
+
agent = ImprovedAgent()
|
277 |
+
except Exception as e:
|
278 |
+
print(f"Full error details: {e}")
|
279 |
+
return f"Error initializing agent: {e}", None
|
280 |
|
281 |
# Process questions
|
282 |
results_log, answers_payload = asyncio.run(run_agent_async_improved(agent, questions_data))
|