LamiaYT commited on
Commit
d382351
·
1 Parent(s): 7b93a21
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -290,7 +290,7 @@ class SimpleGAIAAgent:
290
  # Fallback to web search
291
  return web_search(question)
292
 
293
- def run_evaluation(profile):
294
  """Run the evaluation"""
295
  if not profile:
296
  return "❌ Please log in to Hugging Face first.", None
@@ -422,7 +422,25 @@ with gr.Blocks(title="Simple GAIA Agent") as demo:
422
  interactive=False
423
  )
424
 
425
- run_btn.click(fn=run_evaluation, outputs=[status, results_df])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
 
427
  if __name__ == "__main__":
428
  print("🎯 Starting Simple GAIA Agent...")
 
290
  # Fallback to web search
291
  return web_search(question)
292
 
293
+ def run_evaluation(profile=None):
294
  """Run the evaluation"""
295
  if not profile:
296
  return "❌ Please log in to Hugging Face first.", None
 
422
  interactive=False
423
  )
424
 
425
+ def run_with_profile(request: gr.Request):
426
+ """Run evaluation with user profile from request"""
427
+ try:
428
+ # Try to get user info from request
429
+ user_info = getattr(request, 'session', {})
430
+ username = user_info.get('username', None)
431
+
432
+ if username:
433
+ profile = type('Profile', (), {'username': username})()
434
+ return run_evaluation(profile)
435
+ else:
436
+ # For testing, use a default profile
437
+ profile = type('Profile', (), {'username': 'test_user'})()
438
+ return run_evaluation(profile)
439
+
440
+ except Exception as e:
441
+ return f"❌ Authentication error: {e}", None
442
+
443
+ run_btn.click(fn=run_with_profile, outputs=[status, results_df])
444
 
445
  if __name__ == "__main__":
446
  print("🎯 Starting Simple GAIA Agent...")